home *** CD-ROM | disk | FTP | other *** search
Wrap
GW-BASIC | 1984-11-12 | 47.6 KB | 1,411 lines
1 '* * * * * * * * * * * * * * STOKBOND.BAS * * * * * * * * * * * * * * * * 2 '* * * * (C) COPYRIGHT 1984 DOUGLAS F. HENWOOD--ALL RIGHTS RESERVED * * * 3 ' ver 0.999 4 CLEAR ,,2000:LOCATE ,,1:KEY OFF:FOR N%=1 TO 10:KEY N%,"":NEXT:WIDTH 80 6 SCR.WID%=80:SCR.PTS%=20:PROG.SCR%=5:DEF FNCT%(FEELD$)=INT((SCR.WID%-LEN(FEELD$))/2) 8 HOR.LIN%=196:VER.LIN%=179:JOINT%=195:L.L.CORNER%=192:NOTCH%=193:GOSUB 10000 11 OPTION BASE 1:DIM MENU.PROMPT$(10):DIM WHOLE.REC.BUF$(100) 12 DIM VAL.BUF!(300,4):DIM IO.BUF$(20,4):DIM FLD.PTR$(20,2,2):DIM STK.INX$(20) 13 DEF FNPS$(A$)=MKS$(VAL(A$)):DEF FNUS$(A$)=STR$(CVS(A$)) 14 DEF FNEXTRACT$(X$,N%)=MID$(X$,((N%-1)*4)+1,4):DEF FNSTK.EXTRACT$(X$,N%)=MID$(X$,((N%-1)*8)+1,8) 15 DEF FNNUM.EXTRACT!(X$,N%)=CVS(FNEXTRACT$(X$,N%)):DEF FNSTRIP$(X!)=RIGHT$(STR$(X!),LEN(STR$(X!))-1) 17 DEF FNROW%(X$)=VAL(LEFT$(X$,2))+PROG.SCR%:DEF FNCOL%(X$)=VAL(RIGHT$(X$,2)) 18 DEF FNUPPER%(A$)=ASC(A$)>=65 AND ASC(A$)<=90:DEF FNLOWER%(A$)=ASC(A$)>=97 AND ASC(A$)<=122 22 DEF FNLETTER%(A$)=A$=" " OR ASC(A$)>=65 AND ASC(A$)<=122 AND NOT (ASC(A$)>=91 AND ASC(A$)<=96) 24 DEF FNOP%(A$)=ASC(A$)>=39 AND ASC(A$)<=47 AND ASC(A$)<>44 26 DEF FNCONTROL%(A$)=ASC(A$)<=31:DEF FNNUMBER%(A$)=ASC(A$)>=48 AND ASC(A$)<=57 30 DEF FNNUMOP%(A$)=FNNUMBER%(A$) OR FNOP%(A$) OR A$=" ":DEF FNPC!(OLD!,NW!)=(NW!-OLD!)/OLD!*100 32 DEF FNTOUPPER$(A$)=CHR$(ASC(A$)-32):DEF FNFOLD$(A$)=CHR$(ASC(A$)+(ASC(A$)>90)*32) 34 UP.ARROW%=72:DOWN.ARROW%=80:LFT.ARROW%=75:RT.ARROW%=77:F1%=59:F2%=60 36 DEF FNARROW%(A%)=(A%=UP.ARROW% OR A%=DOWN.ARROW% OR A%=LFT.ARROW% OR A%=RT.ARROW%) 38 BS$=CHR$(29)+CHR$(32)+CHR$(29):DEF FNA!(DBD%,Y.LEN%)=(DBD%/(2*Y.LEN%))-0.25 43 DEF FNB!(DBD%,Y.LEN%)=(DBD%/Y.LEN%):DEF FNC!(P!)=(P!-100)/P! 45 DEF FNQUAD!(A!,B!,C!)=((((B!^2)-(4*A!*C!))^0.5)-B!)/(2*A!) 47 DEF FNTRIN!(X$)=(CVS(FNEXTRACT$(X$,8))/CVS(FNEXTRACT$(X$,9)))/(CVS(FNEXTRACT$(X$,12))/CVS(FNEXTRACT$(X$,13))) 48 DEF FNAD!(X$)=CVS(FNEXTRACT$(X$,8))-CVS(FNEXTRACT$(X$,9)) 50 D.T.L$="That date is too late":D.T.E$="That date is too early":N.E.D$="There is not enough data to do that" 1000 MAX.COL%=2:MAX.ROW%=11 1005 FOR MOD.TYP%=1 TO 2:FOR ROW%=1 TO MAX.ROW%:FOR COL%=1 TO MAX.COL%:READ FLD.PTR$(ROW%,COL%,MOD.TYP%):NEXT:NEXT:NEXT 1070 DATA 1,0,2,3,4,5,6,7,8,0,9,0,10,0,11,0,12,0,13,0,14,15 1075 DATA 1,0,2,0,3,0,4,6,5,0,7,10,8,11,9,12,13,0,14,0,15,0 2000 FOR N%=1 TO 7000:NEXT:LOCATE ,,1 2001 ON ERROR GOTO 60000 2002 CLS:LOCATE 24,1:PRINT "What drive are your data files on?"; 2004 X%=24:Y%=36:MAX.LN%=1:TEST.TYP%=3:GOSUB 44000 2006 IF NOT FNLETTER%(INP.TMP$) THEN PRINT CHR$(7)+BS$;:GOTO 2002 2008 DR$=INP.TMP$ 9998 GOTO 11000 9999 ' 10000 CLS:PR.ST$="S T O C K A N D B O N D A N A L Y S T":COLOR 15,0 10002 LOCATE 4,FNCT%(PR.ST$),0:PRINT PR.ST$:COLOR 7,0 10003 PR.ST$="for PC Disk--ver 1.0":LOCATE 5,FNCT%(PR.ST$):PRINT PR.ST$ 10004 PR.ST$="(c) COPYRIGHT 1984 BY DOUGLAS F. HENWOOD" 10005 LOCATE 6,FNCT%(PR.ST$):PRINT PR.ST$ 10006 PR.ST$="All rights reserved." 10007 LOCATE 7,FNCT%(PR.ST$):PRINT PR.ST$:GOSUB 10050 10008 LOCATE 10,10 10009 PRINT "Nothing in this program should be construed as investment 10010 PRINT TAB(10) "advice, or recommendations of the purchase or sale of any 10011 PRINT TAB(10) "securities, or the advocacy of any strategy. It assumes a 10012 PRINT TAB(10) "sophisticated knowledge of the securities markets, and is 10013 PRINT TAB(10) "designed to help experienced investors keep track of some 10014 PRINT TAB(10) "widely followed indicators and to apply classic techniques 10015 PRINT TAB(10) "to market analysis. Neither the author of the program nor 10016 PRINT TAB(10) "its publisher assume any responsibility for investment 10017 PRINT TAB(10) "losses suffered by the users of this program." 10020 PRINT:PRINT TAB(10) "Reproduction or alteration of this program in whole or 10021 PRINT TAB(10) "in part for any purpose other than making backup copies 10022 PRINT TAB(10) "for the exclusive use of the original user is forbidden."; 10026 RETURN 10050 X.TOP%=3:X.BOT%=8:Y.LFT%=14:Y.RT%=64:ULC$=CHR$(218):LRC$=CHR$(217):LLC$=CHR$(192):URC$=CHR$(191) 10054 LOCATE X.TOP%,Y.LFT%:PRINT STRING$(50,HOR.LIN%):LOCATE X.BOT%,Y.LFT%:PRINT STRING$(50,HOR.LIN%) 10057 LOCATE X.TOP%,Y.RT%:PRINT URC$:LOCATE X.BOT%,Y.RT%:PRINT LRC$ 10058 FOR X%=X.TOP%+1 TO X.BOT%-1:LOCATE X%,Y.LFT%:PRINT CHR$(VER.LIN%):NEXT 10060 LOCATE X.TOP%,Y.LFT%:PRINT ULC$:LOCATE X.BOT%,Y.LFT%:PRINT LLC$ 10061 FOR X%=X.TOP%+1 TO X.BOT%-1:LOCATE X%,Y.RT%:PRINT CHR$(VER.LIN%):NEXT 10062 RETURN 10999 ' 11000 PROG.NAM$="STOCK/BOND ANALYST":PROG.SECT$="Main menu":GOSUB 40010 11006 GOSUB 41500:IF ERR.FLAG% THEN 11006 ELSE ERR.FLAG%=0 11007 DOS.FLAG%=-1 11010 MAX.CHOICE%=3:MAX.LEN%=0:MENU.PROMPT$(1)="STOCKS":MENU.PROMPT$(2)="BONDS":MENU.PROMPT$(3)="BACKGROUND-DATA SOURCES 11020 GOSUB 40100 11030 IF DONE.FLAG% THEN SYSTEM 11035 DOS.FLAG%=0:ON MEN.CHC% GOSUB 20000,30000,25000 11040 GOTO 11000 20000 ' 20006 BOND.MOD%=0:PROG.NAM$="STOCK ANALYST":PROG.SECT$="Main menu":GOSUB 40010 20009 MAX.CHOICE%=3:MAX.LEN%=0 20011 MENU.PROMPT$(1)="STOCK MARKET MODEL":MENU.PROMPT$(2)="STOCK PRICE HISTORY" 20015 MENU.PROMPT$(MAX.CHOICE%)="STOCK VALUATION ANALYSIS":GOSUB 40100 20019 IF DONE.FLAG% THEN DONE.FLAG%=0:RETURN 20021 ON MEN.CHC% GOSUB 21000,22000,23000 20022 GOTO 20006 20098 RETURN 20999 ' 21000 ' 21004 STK.HIS%=0:STK.MOD%=-1 21005 GOSUB 41015:IF INIT.FLAG% THEN GOSUB 21050 21006 GOSUB 41020:GOSUB 41030 21008 GOSUB 42100:GOSUB 41040 21010 START.DEF%=1:END.DEF%=17:MOD.TYP%=1:PRN.MAX%=15 21012 OFFSET%=START.DEF%-1:BUF.MAX%=END.DEF%-START.DEF%+1:VOL.FLAG%=0 21014 GOSUB 42000 21016 PROG.SECT$="Model main menu":GOSUB 40010 21018 MAX.CHOICE%=3:MAX.LEN%=0 21020 MENU.PROMPT$(1)="ENTER/DISPLAY/EDIT DATA":MENU.PROMPT$(2)="GRAPH DATA" 21024 MENU.PROMPT$(MAX.CHOICE%)="MARKET SNAPSHOT":GOSUB 40100 21028 IF DONE.FLAG% THEN DONE.FLAG%=0:RETURN 21030 ON MEN.CHC% GOSUB 21200,21400,21600 21032 GOTO 21016 21035 RETURN 21039 ' 21050 GOSUB 50950:START.DAT%=DT.INT%:CUR.DAT%=0:LAST.REC%=1 21055 GOSUB 41020:GOSUB 41030:GOSUB 42200:GOSUB 41040:REC.NUM%=2:GOSUB 42900 21057 RETURN 21059 ' 21199 ' 21200 ' 21205 PROG.SECT$="Disp/edit/add model data":GOSUB 40010 21207 REDO.FLAG%=0 21208 CLOSE:GOSUB 41020:GOSUB 41030:GOSUB 42100:GOSUB 41040 21210 GOSUB 40200:GOSUB 42300 21212 IF DAT$="" THEN RETURN ELSE ON DAT.BRANCH% GOSUB 21300,21350 21217 IF REDO.FLAG% THEN 21207 21220 RETURN 21299 ' 21300 ' 21306 PROG.SECT$="Display/edit model data":GOSUB 40010:GOSUB 40200 21308 REC.NUM%=CUR.DAT%-START.DAT%+2 21310 GET#1,REC.NUM% 21312 REC.BUF$=RECORD$ 21316 GOSUB 42800:REPORT.DO%=-1:PRN.MAX%=BUF.MAX%-2 21318 GOSUB 42500 21319 GOSUB 42700:GOSUB 42775 21321 IF EDIT.BRANCH%=1 THEN GOSUB 43002:RETURN 21323 IF EDIT.BRANCH%=2 THEN REDO.FLAG%=-1:RETURN 21329 IF EDIT.BRANCH%=3 THEN REDO.FLAG%=0:RETURN 21331 RETURN 21349 ' 21350 ' 21356 PROG.SECT$="Enter new data":GOSUB 40010:GOSUB 40200 21357 REC.NUM%=CUR.DAT%-START.DAT%+2 21358 IF REC.NUM%>LAST.REC%+1 THEN GOSUB 42900 21360 REPORT.DO%=0:PRN.MAX%=BUF.MAX%-2:GOSUB 42500 21362 TEST.TYP%=2:MAX.LN%=10:GOSUB 42600 21364 GOSUB 42700:GOSUB 42775 21366 IF EDIT.BRANCH%=1 THEN GOSUB 43002:RETURN 21372 IF EDIT.BRANCH%=2 THEN GOSUB 42850:LAST.REC%=REC.NUM%:GOSUB 41030:GOSUB 42200 21374 RETURN 21400 ' 21402 PROG.SECT$="Graph data":GOSUB 40010 21404 GOSUB 42375:IF DAT$="" THEN RETURN ELSE START.REC%=DT.INT%-START.DAT%+2 21406 GRAFIX.FLAG%=0 21407 IF GRAFIX.FLAG% THEN H.POINTS%=100 ELSE H.POINTS%=75 21412 MENU.PROMPT$(1)="Price/moving avg/volume" 21413 MENU.PROMPT$(2)="Single indicator" 21414 MENU.PROMPT$(3)="Two indicators" 21415 MAX.CHOICE%=3:GOSUB 40100 21420 IF DONE.FLAG% THEN DONE.FLAG%=0:RETURN 21422 GRAF.TYP%=MEN.CHC%:ON GRAF.TYP% GOSUB 46000,46016,46030 21434 RETURN 21600 ' 21602 PROG.SECT$="Market snapshot":GOSUB 40010 21604 GOSUB 41020:GOSUB 41030:GOSUB 42100:GOSUB 41040:GOSUB 40200:GOSUB 42350 21606 REC.NUM.START%=CUR.DAT%-START.DAT%+2:IF REC.NUM.START%<12 THEN ERROR 118 21608 FILL.COUNT%=10:GOSUB 42880 21610 TRIN.CUM!=0:VOL.CUM!=0:UP.VOL.CUM!=0:AD.DIFF!=0 21612 FOR N%=1 TO FILL.COUNT% 21614 REC.TMP$=WHOLE.REC.BUF$(N%) 21616 TRIN.CUM!=TRIN.CUM!+FNTRIN!(REC.TMP$) 21617 AD.DIFF!=FNAD!(REC.TMP$)+AD.DIFF! 21618 VOL.CUM!=VOL.CUM!+CVS(FNEXTRACT$(REC.TMP$,11)) 21620 UP.VOL.CUM!=UP.VOL.CUM!+CVS(FNEXTRACT$(REC.TMP$,12)) 21622 NEXT 21624 REC.TMP$=WHOLE.REC.BUF$(10) 21626 VOL.LAST!=CVS(FNEXTRACT$(REC.TMP$,11)) 21630 LOCATE 1,60:PRINT SPACE$(19):LOCATE 1,60:PRINT "Report for " DT.PRN$ 21631 LOCATE 2,60:PRINT SPACE$(19):LOCATE 3,60:PRINT SPACE$(19); 21632 COLOR 15,0:LOCATE 6,5:PRINT "Index";:LOCATE 6,25:PRINT "Last" 21634 LOCATE 6,40:PRINT "5-day change":LOCATE 6,55:PRINT "10-day change":COLOR 7,0 21636 INX.DESC.TMP$="Dow Jones Indus":DOW!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(10),1)) 21638 DOW.5!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(5),1)):DOW.10!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(1),1)) 21640 INX.TMP!=DOW!:INX.TMP.5!=DOW.5!:INX.TMP.10!=DOW.10!:X%=8:GOSUB 21682 21642 INX.DESC.TMP$="S & P 500":SP!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(10),2)) 21644 SP.5!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(5),2)):SP.10!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(1),2)) 21646 INX.TMP!=SP!:INX.TMP.5!=SP.5!:INX.TMP.10!=SP.10!:X%=9:GOSUB 21682 21648 INX.DESC.TMP$="NYSE Composite":NYSE!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(10),4)) 21650 NYSE.5!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(5),4)):NYSE.10!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(1),4)) 21652 INX.TMP!=NYSE!:INX.TMP.5!=NYSE.5!:INX.TMP.10!=NYSE.10!:X%=10:GOSUB 21682 21654 INX.DESC.TMP$="Value Line":VL!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(10),6)) 21656 VL.5!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(5),6)):VL.10!=CVS(FNEXTRACT$(WHOLE.REC.BUF$(1),6)) 21658 INX.TMP!=VL!:INX.TMP.5!=VL.5!:INX.TMP.10!=VL.10!:X%=11:GOSUB 21682 21660 LOCATE 13,10:PRINT "Last volume":LOCATE 13,40:PRINT USING "###.##";VOL.LAST!/1000;:PRINT " million" 21664 LOCATE 14,10:PRINT "10-day avg vol":LOCATE 14,40:PRINT USING "###.##";VOL.CUM!/10000;:PRINT " million" 21668 LOCATE 15,10:PRINT "10-day cum up vol":LOCATE 15,40:PRINT USING "###.##";UP.VOL.CUM!/1000;:PRINT " million" 21672 LOCATE 17,10:PRINT "10-day adv/decl diff":LOCATE 17,40:PRINT USING "+#####";AD.DIFF! 21676 LOCATE 19,10:PRINT "10-day TRIN":LOCATE 19,40:PRINT USING "##.##";TRIN.CUM!/10 21679 GOSUB 42740:GOSUB 44200 21680 ' 21682 ' 21684 LOCATE X%,5:PRINT INX.DESC.TMP$:LOCATE X%,25:PRINT USING "####.##";INX.TMP! 21688 LOCATE X%,40:PRINT USING "+###.##";FNPC(INX.TMP.5!,INX.TMP!) 21690 LOCATE X%,55:PRINT USING "+###.##";FNPC(INX.TMP.10!,INX.TMP!) 21692 RETURN 21694 ' 21999 ' 22000 GOSUB 41145:IF INIT.FLAG% THEN GOSUB 22050 22002 CLOSE:GOSUB 41150 22003 GOSUB 41160:GOSUB 42100:GOSUB 41170:GOSUB 42450 22004 STK.HIS%=-1:BOND.MOD%=0:PROG.NAM$="STOCK ANALYST" 22005 PROG.SECT$="Stock price history main menu":GOSUB 40010 22006 MAX.CHOICE%=6:MAX.LEN%=0 22010 MENU.PROMPT$(1)="INITIALIZE A NEW STOCK" 22012 MENU.PROMPT$(2)="DELETE A STOCK" 22015 MENU.PROMPT$(3)="DISPLAY/EDIT HEAD INFORMATION" 22020 MENU.PROMPT$(4)="ENTER/DISPLAY/EDIT PRICE/VOLUME DATA" 22023 MENU.PROMPT$(5)="ADJUST FOR SPLIT" 22025 MENU.PROMPT$(MAX.CHOICE%)="GRAPH DATA" 22030 GOSUB 40100 22035 IF DONE.FLAG% THEN DONE.FLAG%=0:RETURN 22040 ON MEN.CHC% GOSUB 22300,22350,22400,22500,22600,22650 22042 GOTO 22002 22045 RETURN 22050 GOSUB 50950:START.DAT%=DT.INT%:CUR.DAT%=0:LAST.REC%=1 22055 GOSUB 41150:GOSUB 41160:GOSUB 42200:GOSUB 41040:REC.NUM%=22:GOSUB 42900 22057 RETURN 22099 ' 22100 ' 22101 ' 22199 ' 22300 PROG.SECT$="Initialize stock"+STR$(STK.MAX%+1):GOSUB 40010 22302 IF STK.MAX%=20 THEN ERROR 108 22305 START.DEF%=51:END.DEF%=56:OFFSET%=START.DEF%-1:GOSUB 42000 22310 REC.NUM%=STK.MAX%+2:BUF.MAX%=END.DEF%-START.DEF%+1:PRN.MAX%=BUF.MAX% 22317 REPORT.DO%=0:GOSUB 42500:TEST.TYP%=3:MAX.LN%=16:GOSUB 42600:GOSUB 42700:GOSUB 42775 22327 IF EDIT.BRANCH%=3 THEN RETURN 22328 IF EDIT.BRANCH%=1 THEN TEST.TYP%=3:MAX.LN%=16:GOSUB 43500 22329 IF EDIT.BRANCH%=2 THEN WRITE.FLAG%=-1 22330 IF WRITE.FLAG% THEN GOSUB 42250 22349 RETURN 22350 PROG.SECT$="Delete a stock":GOSUB 40010 22351 GOSUB 42475:GOSUB 42485:IF STK.NUM%=0 THEN RETURN 22352 GOSUB 42795:IF NOT CONFIRM.FLAG% THEN RETURN:ELSE LOCATE 23,1:PRINT SPACE$(79);:LOCATE 23,1:PRINT "Ready to delete " STK.INX$(STK.NUM%) "; press any key to continue, ESC to abort";:TMP$=INPUT$(1):IF TMP$=CHR$(27) THEN RETURN 22353 LOCATE 23,1:PRINT SPACE$(79);:GOSUB 42785:START.REC%=STK.NUM%+1:GOSUB 41180 22354 FOR REC%=START.REC% TO 20 22355 GET #1,REC%+1:REC.TMP$=RECORD$:LSET RECORD$=STRING$(160,0):PUT #1,REC%+1 22356 LSET RECORD$=REC.TMP$:PUT #1,REC% 22357 NEXT 22358 FOR REC%=22 TO LAST.REC% 22359 GET #1,REC% 22361 REC.TMP$=RECORD$:IF REC.TMP$=STRING$(160,0) THEN 22365 22363 REC.TMP$=LEFT$(REC.TMP$,(STK.NUM%-1)*8)+RIGHT$(REC.TMP$,160-(STK.NUM%*8))+STRING$(8,0) 22364 LSET RECORD$=REC.TMP$:PUT #1,REC% 22365 NEXT 22367 RETURN 22399 ' 22400 ' 22405 PROG.SECT$="Display/edit stock data":GOSUB 40010 22407 START.DEF%=51:END.DEF%=56:OFFSET%=START.DEF%-1 22408 BUF.MAX%=END.DEF%-START.DEF%+1:GOSUB 42000 22411 GOSUB 42475:GOSUB 42485:REC.NUM%=VAL(INP.TMP$)+1:GOSUB 41170:GET #1,REC.NUM% 22419 GOSUB 42275:PRN.MAX%=BUF.MAX%:REPORT.DO%=-1:GOSUB 42500 22423 GOSUB 42700:GOSUB 42775 22425 IF EDIT.BRANCH%=3 THEN RETURN 22426 IF EDIT.BRANCH%=1 THEN TEST.TYP%=3:MAX.LN%=16:GOSUB 43500 22427 IF EDIT.BRANCH%=2 THEN WRITE.FLAG%=-1 22429 IF WRITE.FLAG% THEN GOSUB 42250 22430 RETURN 22499 ' 22500 REDO.FLAG%=0:ERR.FLAG%=0 22510 PROG.SECT$="Enter/display/edit price history data":GOSUB 40010:GOSUB 42450:IF STK.MAX%=0 THEN ERROR 109 22511 GOSUB 40200:GOSUB 42300:GOSUB 41180:REC.NUM%=CUR.DAT%-START.DAT%+22 22516 IF DAT$="" THEN RETURN ELSE ON DAT.BRANCH% GOSUB 22550,22575 22520 RETURN 22550 ' 22560 PROG.SECT$="Display/edit price/volume data":GOSUB 40010:GOSUB 40200 22562 GET #1,REC.NUM%:REC.BUF$=RECORD$:GOSUB 42950 22566 REPORT.DO%=-1:GOSUB 42550:GOSUB 42700:GOSUB 42775 22570 IF EDIT.BRANCH%=1 THEN GOSUB 43750:RETURN 22571 IF EDIT.BRANCH%=2 THEN REDO.FLAG%=-1:RETURN 22572 IF EDIT.BRANCH%=3 THEN REDO.FLAG%=0:RETURN 22574 ' 22575 PROG.SECT$="Enter price/volume data":GOSUB 40010:REPORT.DO%=0:GOSUB 42550 22576 FOR N%=1 TO STK.MAX% 22577 IF STK.INX$(N%)=STRING$(8,0) THEN IO.BUF$(N%,1)="0":IO.BUF$(N%,2)="0":GOTO 22590 22578 X%=(N%+(N%>10)*10)+7:Y%=((N%>10)*-40)+10 22579 MAX.LN%=10:TEST.TYP%=2:GOSUB 44000:GOSUB 44750:IO.BUF$(N%,1)=INP.TMP$ 22581 MAX.LN%=6:TEST.TYP%=1:Y%=Y%+15:GOSUB 44000:IO.BUF$(N%,2)=INP.TMP$ 22583 NEXT 22584 GOSUB 42700:GOSUB 42775 22585 IF EDIT.BRANCH%=3 THEN RETURN 22586 IF EDIT.BRANCH%=1 THEN GOSUB 43750 22587 GOSUB 42975:LAST.DAT%=CUR.DAT%:LAST.REC%=REC.NUM%:GOSUB 41160:GOSUB 42200 22588 RETURN 22599 ' 22600 PROG.SECT$="Adjust for split":GOSUB 40010 22601 GOSUB 41180:GOSUB 42475:GOSUB 42485:LOCATE 23,1:PRINT SPACE$(75):LOCATE 23,1:PRINT "Enter ratio (e.g. 3/2)"; 22604 X%=23:Y%=24:MAX.LN%=5:TEST.TYP%=2:GOSUB 44000:GOSUB 44750:IF ERR.FLAG% THEN PRINT CHR$(7);:ERR.FLAG%=0:GOTO 22601 22608 SPLIT!=VAL(INP.TMP$):IF SPLIT!=0 THEN PRINT CHR$(7);:GOTO 22604 22609 GOSUB 42795:IF NOT CONFIRM.FLAG% THEN RETURN 22610 GOSUB 42785 22611 FOR REC%=22 TO LAST.REC% 22612 GET #1,REC%:REC.TMP$=RECORD$:SPLIT$=FNSTK.EXTRACT$(REC.TMP$,STK.NUM%) 22613 PR.TMP!=CVS(LEFT$(SPLIT$,4)):VOL.TMP!=CVS(RIGHT$(SPLIT$,4)) 22615 IF PR.TMP! THEN TST.TMP$=STR$(PR.TMP!/SPLIT!):INT.FLAG%=0:GOSUB 42990:PR.TMP!=TST.TMP#:VOL.TMP!=INT((VOL.TMP!*SPLIT!)+0.5) 22618 SPLIT$=MKS$(PR.TMP!)+MKS$(VOL.TMP!):MID$(REC.TMP$,((STK.NUM%-1)*8)+1,8)=SPLIT$ 22619 LSET RECORD$=REC.TMP$:PUT #1,REC% 22620 NEXT 22625 RETURN 22649 ' 22650 PROG.SECT$="Graph data":GOSUB 40010 22654 GOSUB 42375:IF DAT$="" THEN RETURN 22655 START.REC%=DT.INT%-START.DAT%+22:GRAF.TYP%=1:GOSUB 46000:RETURN 22999 ' 23000 ' 23302 PROG.SECT$="Graham stock valuation":GOSUB 40010 23304 START.DEF%=57:END.DEF%=60:OFFSET%=START.DEF%-1:GOSUB 42000 23306 BUF.MAX%=END.DEF%-START.DEF%+1:REPORT.DO%=0:PRN.MAX%=BUF.MAX%-1 23308 GOSUB 42500:TEST.TYP%=2:MAX.LN%=10:GOSUB 42600 23310 GROWTH!=VAL(IO.BUF$(1,1)):EPS!=VAL(IO.BUF$(2,1)):AAA.RATE!=VAL(IO.BUF$(3,1)) 23316 THEO.PRICE!=EPS!*(8.5+2*GROWTH!)*(4.4/AAA.RATE!) 23318 LOCATE 20,20:PRINT IO.BUF$(4,3); 23320 LOCATE 20,40:PRINT FNSTRIP$(THEO.PRICE!) 23322 F1.MSG$="Do another valuation":ESC.MSG$="Return to previous menu":GOSUB 42750 23323 GOSUB 44200 23324 IF ASC.RESP%=F1% THEN 23306 ELSE IF ASC.RESP%=27 THEN RETURN ELSE PRINT CHR$(7);:GOTO 23322 25000 OPEN "I",1,"STOKBOND.TXT":CLS 25001 LOCATE 1,1:FOR N%=1 TO 23:LINE INPUT #1,LIN$:PRINT LIN$:NEXT 25002 LOCATE 24,1:PRINT "PRESS ANY KEY TO CONTINUE";:HOOK$=INPUT$(1) 25004 CLS:FOR N%=1 TO 22:LINE INPUT #1,LIN$:PRINT LIN$:NEXT 25006 LOCATE 24,1:PRINT "PRESS ANY KEY TO CONTINUE";:HOOK$=INPUT$(1):RETURN 25007 ` 29999 ' 30000 ' 30006 PROG.NAM$="BOND ANALYST":VOL.FLAG%=0 30007 PROG.SECT$="Main menu":GOSUB 40010 30009 MAX.CHOICE%=3:MAX.LEN%=0 30011 MENU.PROMPT$(1)="BOND MARKET MODEL" 30015 MENU.PROMPT$(MAX.CHOICE%)="BOND VALUATION ANALYSIS" 30016 MENU.PROMPT$(MAX.CHOICE%)="DAYS BETWEEN DATES" 30017 GOSUB 40100 30019 IF DONE.FLAG% THEN DONE.FLAG%=0:RETURN 30021 ON MEN.CHC% GOSUB 31000,32000,33000 30022 GOTO 30006 30098 RETURN 30999 ' 31000 ' 31004 MOD.TYP%=2:BOND.MOD%=-1 31005 GOSUB 41115:IF INIT.FLAG% THEN GOSUB 31050 31006 GOSUB 41120:GOSUB 41130 31008 GOSUB 42100:GOSUB 41140 31010 START.DEF%=18:END.DEF%=32 31012 OFFSET%=START.DEF%-1:BUF.MAX%=END.DEF%-START.DEF%+1:PRN.MAX%=BUF.MAX% 31014 GOSUB 42000 31016 PROG.SECT$="Model main menu":GOSUB 40010 31018 MAX.CHOICE%=3:MAX.LEN%=0 31020 MENU.PROMPT$(1)="ENTER/DISPLAY/EDIT DATA 31022 MENU.PROMPT$(2)="GRAPH DATA 31024 MENU.PROMPT$(MAX.CHOICE%)="MARKET SNAPSHOT 31026 GOSUB 40100 31028 IF DONE.FLAG% THEN DONE.FLAG%=0:RETURN 31030 ON MEN.CHC% GOSUB 31200,31400,31600 31031 GOTO 31016 31032 RETURN 31050 GOSUB 50950:START.DAT%=DT.INT%:CUR.DAT%=0:LAST.REC%=1 31055 GOSUB 41120:GOSUB 41130:GOSUB 42200:GOSUB 41140:REC.NUM%=2:GOSUB 42900 31057 RETURN 31099 ' 31200 ' 31203 ' 31205 PROG.SECT$="Enter/display/edit model data":GOSUB 40010 31206 REDO.FLAG%=0 31207 GOSUB 40200:GOSUB 42300 31209 IF DAT$="" THEN RETURN ELSE ON DAT.BRANCH% GOSUB 31300,31350 31211 RETURN 31299 ' 31300 ' 31306 PROG.SECT$="Display/edit model data":GOSUB 40010:GOSUB 40200 31308 GOSUB 42400:GOSUB 40200:GET #1,REC.NUM%:REC.BUF$=RECORD$ 31316 GOSUB 42800:REPORT.DO%=-1:GOSUB 42500:GOSUB 42700:GOSUB 42775 31321 IF EDIT.BRANCH%=1 THEN GOSUB 43002:RETURN 31323 IF EDIT.BRANCH%=2 THEN REDO.FLAG%=-1:RETURN 31329 IF EDIT.BRANCH%=3 THEN REDO.FLAG%=0:RETURN 31349 ' 31350 ' 31356 PROG.SECT$="Enter new model data":GOSUB 40010:GOSUB 40200 31357 REC.NUM%=LAST.REC%+1 31360 REPORT.DO%=0:GOSUB 42500 31362 TEST.TYP%=2:MAX.LN%=10:GOSUB 42600 31364 GOSUB 42700:GOSUB 42775 31366 IF EDIT.BRANCH%=1 THEN GOSUB 43002:RETURN 31368 IF EDIT.BRANCH%=2 THEN GOSUB 42850:LAST.REC%=REC.NUM%:GOSUB 41130:GOSUB 42200 31370 RETURN 31399 ' 31400 ' 31402 PROG.SECT$="Graph data":GOSUB 40010:GOSUB 40200 31404 GOSUB 42375:IF DAT$="" THEN RETURN ELSE LOCATE 23,1:PRINT SPACE$(79); 31405 CUR.DAT%=DT.INT%:GOSUB 42400:START.REC%=REC.NUM% 31413 MENU.PROMPT$(1)="Single indicator" 31414 MENU.PROMPT$(2)="Two indicators" 31415 MAX.CHOICE%=2:GOSUB 40100 31420 IF DONE.FLAG% THEN DONE.FLAG%=0:RETURN 31422 GRAF.TYP%=MEN.CHC%+1:ON GRAF.TYP%-1 GOSUB 46016,46030 31424 RETURN 31429 ' 31600 ' 31602 PROG.SECT$="Market snapshot":GOSUB 40010 31604 GOSUB 41120:GOSUB 41130:GOSUB 42100:GOSUB 41140:GOSUB 40200:GOSUB 42350 31605 GOSUB 42400:REC.NUM.START%=REC.NUM%:IF REC.NUM.START%<4 THEN ERROR 120 31606 FILL.COUNT%=3:GOSUB 42880 31608 REC.TMP$=WHOLE.REC.BUF$(1):NFR.1!=CVS(FNEXTRACT$(REC.TMP$,15)) 31610 REC.TMP$=WHOLE.REC.BUF$(2):NFR.2!=CVS(FNEXTRACT$(REC.TMP$,15)) 31612 REC.TMP$=WHOLE.REC.BUF$(3):NFR.3!=CVS(FNEXTRACT$(REC.TMP$,15)) 31613 LOCATE 1,60:PRINT SPACE$(19):LOCATE 1,60:PRINT "Report for " CUR.PRN$ 31614 LOCATE 2,60:PRINT SPACE$(19):LOCATE 3,60:PRINT SPACE$(19); 31615 IF NFR.1!=NFR.2! THEN NFR.AVG!=(NFR.1!+NFR.3!)/2 ELSE NFR.AVG!=(NFR.1!+NFR.2!)/2 31618 DISC.RT!=CVS(FNEXTRACT$(REC.TMP$,1)):FED.FUNDS!=CVS(FNEXTRACT$(REC.TMP$,2)) 31620 COMM.PAPER!=CVS(FNEXTRACT$(REC.TMP$,3)):T.BILL.3MO!=CVS(FNEXTRACT$(REC.TMP$,4)) 31622 T.BOND.30YR!=CVS(FNEXTRACT$(REC.TMP$,12)):MUNI!=CVS(FNEXTRACT$(REC.TMP$,13)) 31624 LOCATE 10,10:COLOR 15,0:PRINT "Spreads";:COLOR 7,0 31626 LOCATE 12,15:PRINT "Discount rate - Fed funds"; 31628 LOCATE 12,50:PRINT USING "+###.##";DISC.RT!-FED.FUNDS! 31630 LOCATE 13,15:PRINT "Comm paper - 3 mo T-bills";: 31632 LOCATE 13,50:PRINT USING "+###.##";COMM.PAPER!-T.BILL.3MO! 31634 LOCATE 14,15:PRINT "30-yr T-bonds - 3 mo T-bills"; 31636 LOCATE 14,50:PRINT USING "+###.##";T.BOND.30YR!-T.BILL.3MO! 31638 LOCATE 15,15:PRINT "30-yr T-bonds - long muni";: 31640 LOCATE 15,50:PRINT USING "+###.##";T.BOND.30YR!-MUNI! 31642 LOCATE 20,15:PRINT "4-wk avg, net "; 31644 IF NFR.AVG!<0 THEN PRINT "borrowed";: ELSE PRINT "free"; 31646 PRINT " res";:LOCATE 20,50:PRINT USING "+###.##";NFR.AVG!;:PRINT " (billion)" 31647 GOSUB 42740:GOSUB 44200 31648 RETURN 31650 ' 32000 ' 32002 PROG.SECT$="Analyze individual bond":GOSUB 40010 32003 MAX.CHOICE%=2:MAX.LEN%=0:MENU.PROMPT$(1)="TREASURY BILL" 32006 MENU.PROMPT$(MAX.CHOICE%)="NOTE OR BOND":GOSUB 40100 32012 IF DONE.FLAG% THEN DONE.FLAG%=0:RETURN 32014 ON MEN.CHC% GOSUB 32028,32100 32016 RETURN 32019 ' 32028 ' 32038 PROG.SECT$="T-bill analysis":GOSUB 40010:T.BILL.FLAG%=-1 32040 START.DEF%=34:END.DEF%=37:OFFSET%=START.DEF%-1:GOSUB 42000 32042 BUF.MAX%=END.DEF%-START.DEF%+1:PRN.MAX%=3:REPORT.DO%=0 32044 GOSUB 42500:TEST.TYP%=2:MAX.LN%=10:GOSUB 42600 32045 DAT1$=IO.BUF$(1,1):DAT2$=IO.BUF$(2,1):GOSUB 52000:P!=VAL(IO.BUF$(3,1)) 32048 IF DBD%>360 THEN GOSUB 32070 ELSE GOSUB 32060 32050 IO.BUF$(4,1)=FNSTRIP$(YLD!*100) 32051 X%=FNROW%(IO.BUF$(4,4)):Y%=FNCOL%(IO.BUF$(4,4)) 32053 LOCATE X%,Y%:PRINT IO.BUF$(4,3):LOCATE X%,Y%+18:PRINT IO.BUF$(4,1) 32054 T.BILL.FLAG%=0 32057 F1.MSG$="Do another analysis":ESC.MSG$="Return to previous menu":GOSUB 42750:GOSUB 44200 32059 IF ASC.RESP%=F1% THEN 32044 ELSE IF ASC.RESP%=27 THEN RETURN ELSE PRINT CHR$(7);:GOTO 32057 32060 ' 32064 YLD!=((100-P!)*Y.1.LEN%)/(P!*DBD%):RETURN 32070 ' 32074 A!=FNA!(DBD%,Y.1.LEN%):B!=FNB!(DBD%,Y.1.LEN%):C!=FNC!(P!):YLD!=FNQUAD!(A!,B!,C!):RETURN 32099 ' 32100 ' 32101 START.DEF%=38:END.DEF%=50:OFFSET%=START.DEF%-1:GOSUB 42000 32102 BUF.MAX%=END.DEF%-START.DEF%+1:PRN.MAX%=7:REPORT.DO%=0:BOND.FLAG%=-1 32104 GOSUB 42500:TEST.TYP%=2:MAX.LN%=10:GOSUB 42600 32106 GOSUB 42785 32110 DAT1$=IO.BUF$(1,1):DAT2$=IO.BUF$(2,1):GOSUB 52000:BOND.FLAG%=0 32120 YR.TO.MAT!=DBD%/365.25:P!=VAL(IO.BUF$(3,1)):FACE!=VAL(IO.BUF$(4,1)) 32122 COUP!=VAL(IO.BUF$(5,1)):DAT$=IO.BUF$(6,1):GOSUB 51050:LAST.COUP%=DT.INT% 32200 TAX!=VAL(IO.BUF$(7,1)):ACCR.INT!=(DT.1%-LAST.COUP%)/365*FACE!*COUP!/100 32220 COST!=P!*FACE!/100:YR.PMT!=FACE!*COUP!/100 32230 CURR.YLD!=COUP!/P!*100:AFTER.TAX!=CURR.YLD*(100-TAX!)/100 32240 YLD!=(COUP!+((100-P!)/YR.TO.MAT!))/((100+P!)/2) 32250 IO.BUF$(8,1)=FNSTRIP$(COST!):IO.BUF$(9,1)=FNSTRIP$(ACCR.INT!) 32260 IO.BUF$(10,1)=FNSTRIP$(COST!+ACCR.INT!):IO.BUF$(11,1)=FNSTRIP$(CURR.YLD!) 32270 IO.BUF$(12,1)=FNSTRIP$(AFTER.TAX!):IO.BUF$(13,1)=FNSTRIP$(YLD!*100) 32275 GOSUB 42792 32280 FOR N%=8 TO 13 32282 X%=FNROW%(IO.BUF$(N%,4)):Y%=FNCOL%(IO.BUF$(N%,4)) 32284 LOCATE X%,Y%:PRINT IO.BUF$(N%,3):LOCATE X%,Y%+18 32285 IF N%<11 THEN PRINT USING "####.##";VAL(IO.BUF$(N%,1)) ELSE PRINT USING "##.##";VAL(IO.BUF$(N%,1)) 32288 NEXT 32290 F1.MSG$="Do another analysis":ESC.MSG$="Return to previous menu":GOSUB 42750:GOSUB 44200 32292 IF ASC.RESP%=F1% THEN 32104 ELSE IF ASC.RESP%=27 THEN RETURN ELSE PRINT CHR$(7);:GOTO 32290 32299 ' 33000 PROG.SECT$="Days between dates":GOSUB 40010 33002 MAX.LN%=10:TEST.TYP%=2 33004 X%=7:Y%=20:LOCATE X%,Y%:PRINT "Enter first date":Y%=Y%+18:GOSUB 44000:DAT$=INP.TMP$:GOSUB 51050:IF DT.FLAG% THEN PRINT CHR$(7);:LOCATE 7,20:PRINT SPACE$(50);:DT.FLAG%=0:GOTO 33004 33005 DAT$=INP.TMP$:IF DAT$="" THEN RETURN ELSE GOSUB 51050:DT.1%=DT.INT% 33006 X%=9:Y%=20:LOCATE X%,Y%:PRINT "Enter second date":Y%=Y%+18:GOSUB 44000:DAT$=INP.TMP$:GOSUB 51050:IF DT.FLAG% THEN PRINT CHR$(7);:LOCATE 9,20:PRINT SPACE$(50);:DT.FLAG%=0:GOTO 33006 33007 DAT$=INP.TMP$:IF DAT$="" THEN RETURN ELSE GOSUB 51050:DT.2%=DT.INT% 33009 DBD%=ABS(DT.1%-DT.2%) 33010 LOCATE 12,20:PRINT "There are" DBD% "days between the two dates" 33011 LOCATE 23,1:PRINT "Press any key to return to menu";:HOOK$=INPUT$(1):RETURN 40000 ' 40010 ' 40015 CLS 40020 LOCATE 1,1:COLOR 15,0:PRINT PROG.NAM$;:COLOR 7,0 40025 PRINT ":"+PROG.SECT$ 40030 LOCATE 4,1:PRINT STRING$(80,196) 40032 SCRATCH!=FRE("") 40035 RETURN 40100 LOCATE ,,1 40107 LONGEST$="":DONE.FLAG%=0:MEN.CHC%=0 40110 FOR N%=1 TO MAX.CHOICE% 40115 IF LEN(MENU.PROMPT$(N%))>LEN(LONGEST$) THEN LONGEST$=MENU.PROMPT$(N%) 40120 NEXT 40125 BEG.COL%=FNCT%(LONGEST$)-2 40130 FOR N%=1 TO MAX.CHOICE% 40135 LOCATE PROG.SCR%+N%,BEG.COL%:COLOR 15,0:PRINT N%;:COLOR 7,0:PRINT "- " MENU.PROMPT$(N%) 40140 NEXT 40141 IF DOS.FLAG% THEN DONE.PR$="RETURN TO DOS" ELSE DONE.PR$="RETURN TO PREVIOUS MENU" 40142 DONE.COL%=FNCT%(DONE.PR$)-3 40143 LOCATE PROG.SCR%+N%+1,DONE.COL%:COLOR 15,0:PRINT "<ESC>";:COLOR 7,0:PRINT " "+ DONE.PR$ 40145 LOCATE PROG.SCR%+N%+3,BEG.COL%:PRINT "Enter choice "; 40147 GOSUB 40190 40150 RESP$=INKEY$:IF RESP$="" THEN 40150 40151 GOSUB 40190 40152 IF RESP$=CHR$(27) THEN DONE.FLAG%=-1:RETURN 40153 LOCATE PROG.SCR%+N%+3,BEG.COL%+13:PRINT RESP$; 40154 LOCATE PROG.SCR%+N%+3,BEG.COL%+13 40155 IF NOT FNNUMBER%(RESP$) THEN PRINT CHR$(7);:GOTO 40150 40157 LOCATE PROG.SCR%+N%+3,BEG.COL%:PRINT SPACE$(30):JUNK$=INKEY$ 40160 MEN.CHC%=VAL(RESP$) 40165 IF MEN.CHC%>=1 AND MEN.CHC%<=MAX.CHOICE% THEN MEN.CHC%=VAL(RESP$) ELSE PRINT CHR$(7);:GOTO 40150 40167 SCRATCH!=FRE("") 40168 X%=PROG.SCR%+1:GOSUB 40175 40170 RETURN 40174 ' 40175 LOCATE ,,0:FOR X.LOC%=X% TO 23:LOCATE X.LOC%,1:PRINT SPACE$(79):NEXT:LOCATE X%,1,1:RETURN 40179 ' 40190 DEF SEG=0:POKE 1050,PEEK(1052):RETURN 40199 ' 40200 ' 40205 LOCATE 1,60:PRINT "First entry:" START.PRN$ 40210 IF LAST.DAT%<>0 THEN LOCATE 2,60:PRINT "Last entry: " LAST.PRN$ 40215 IF CUR.PRN$<>"" THEN LOCATE 3,60:PRINT "Curr date: " CUR.PRN$ 40220 RETURN 40229 ' 41015 CLOSE #1:FIL$=DR$+":STOCK.DAT":OPEN "I",1,FIL$ 41016 IF FLNF.FLAG% THEN GOSUB 41250:FLNF.FLAG%=0 41018 RETURN 41019 ' 41020 REC.LEN%=60:CLOSE:OPEN "R",1,FIL$,REC.LEN%:RETURN 41029 ' 41030 FIELD #1,4 AS START.DAT$,4 AS LAST.DAT$,4 AS LAST.REC$,48 AS REST$:RETURN 41039 ' 41040 FIELD #1,REC.LEN% AS RECORD$:RETURN 41049 ' 41115 CLOSE #1:FIL$=DR$+":BOND.DAT":OPEN "I",1,FIL$ 41116 IF FLNF.FLAG% THEN GOSUB 41250:FLNF.FLAG%=0 41118 RETURN 41119 ' 41120 REC.LEN%=64:CLOSE:OPEN "R",1,FIL$,REC.LEN%:RETURN 41129 ' 41130 FIELD #1,4 AS START.DAT$,4 AS LAST.DAT$,4 AS LAST.REC$,REC.LEN%-12 AS REST$:RETURN 41139 ' 41140 FIELD #1,4 AS DAT.REC$,REC.LEN%-4 AS RECORD$:RETURN 41143 ' 41145 CLOSE #1:FIL$=DR$+":STOX.HIS":OPEN "I",1,FIL$ 41146 IF FLNF.FLAG% THEN GOSUB 41250:FLNF.FLAG%=0 41148 RETURN 41149 ' 41150 REC.LEN%=160:OPEN "R",1,FIL$,REC.LEN%:RETURN 41159 ' 41160 FIELD #1, 4 AS START.DAT$,4 AS LAST.DAT$,4 AS LAST.REC$,REC.LEN%-12 AS REST$:RETURN 41169 ' 41170 FIELD #1, 8 AS SYMBOL$,16 AS S.NAM$,4 AS START.DAT$,4 AS LAST.DAT$,4 AS EARN$,4 AS ALPHA$,4 AS BETA$,4 AS VOLATIL$,112 AS REST$:RETURN 41179 ' 41180 FIELD #1, 160 AS RECORD$:RETURN 41198 ' 41199 ' 41250 F1.MSG$="Try another disk":F2.MSG$="Initialize new file":ESC.MSG$="Return to main menu" 41252 GOSUB 42750:GOSUB 42775 41254 IF EDIT.BRANCH%=3 THEN RUN 41256 IF EDIT.BRANCH%=2 THEN INIT.FLAG%=-1:RETURN 41258 LOCATE 23,40:COLOR 0,7:PRINT "Change disks and press any key to continue";:COLOR 7,0 41260 JUNK$=INPUT$(1):INIT.FLAG%=0:RETURN 41269 ' 41500 CLOSE:OPEN "I",1,"STOKBOND.OVR":CLOSE:RETURN 42000 OPEN "R",2,"STOKBOND.OVR",26 42010 FIELD #2,20 AS NAM$,4 AS ROW.COL$,2 AS EOL$ 42015 FOR N%=START.DEF% TO END.DEF% 42020 GET #2,N% 42025 NAM.TMP$=NAM$:ROW.COL.TMP$=ROW.COL$ 42030 TR.SP$=NAM.TMP$:GOSUB 42050:IO.BUF$(N%-OFFSET%,3)=TR.SP$ 42035 IO.BUF$(N%-OFFSET%,4)=ROW.COL.TMP$ 42040 NEXT 42045 CLOSE #2 42046 SCRATCH!=FRE("") 42047 RETURN 42049 ' 42050 ' 42055 WHILE RIGHT$(TR.SP$,1)=" ":TR.SP$=LEFT$(TR.SP$,LEN(TR.SP$)-1):WEND:RETURN 42059 ' 42100 ' 42105 GET #1,1:START.DAT%=CVS(START.DAT$):LAST.DAT%=CVS(LAST.DAT$):LAST.REC%=CVS(LAST.REC$) 42115 DT=START.DAT%:GOSUB 51490:START.PRN$=DT.PRN$ 42120 IF LAST.DAT%<>0 THEN DT=LAST.DAT%:GOSUB 51490:LAST.PRN$=DT.PRN$ 42121 SCRATCH!=FRE("") 42122 RETURN 42199 ' 42200 ' 42205 LSET START.DAT$=MKS$(START.DAT%):LSET LAST.DAT$=MKS$(CUR.DAT%) 42210 LSET LAST.REC$=MKS$(LAST.REC%):LSET REST$=STRING$(REC.LEN%-12,0) 42215 PUT #1,1 42220 RETURN 42229 ' 42250 ' 42255 LSET SYMBOL$=IO.BUF$(1,1):LSET S.NAM$=IO.BUF$(2,1) 42257 ' 42260 LSET EARN$=FNPS$(IO.BUF$(3,1)):LSET ALPHA$=FNPS$(IO.BUF$(4,1)) 42262 LSET BETA$=FNPS$(IO.BUF$(5,1)):LSET VOLATIL$=FNPS$(IO.BUF$(6,1)) 42264 PUT #1,REC.NUM% 42266 RETURN 42268 ' 42275 ' 42282 IO.BUF$(1,1)=SYMBOL$:IO.BUF$(2,1)=S.NAM$ 42284 EARN.TMP$=EARN$:ALPHA.TMP$=ALPHA$:BETA.TMP$=BETA$:VOLATIL.TMP$=VOLATIL$ 42286 IO.BUF$(3,1)=FNUS$(EARN.TMP$):IO.BUF$(4,1)=FNUS$(ALPHA.TMP$) 42288 IO.BUF$(5,1)=FNUS$(BETA.TMP$):IO.BUF$(6,1)=FNUS$(VOLATIL.TMP$) 42289 SCRATCH!=FRE("") 42290 RETURN 42299 ' 42300 ' 42305 GOSUB 50950:IF DAT$="" THEN RETURN 42310 IF DT.INT%<START.DAT% THEN ERROR 112 42315 CUR.PRN$=DAT$:CUR.DAT%=DT.INT% 42320 IF CUR.DAT%>LAST.DAT% THEN DAT.BRANCH%=2 ELSE DAT.BRANCH%=1 42325 RETURN 42349 ' 42350 ' 42355 GOSUB 50950:IF DAT$="" THEN RETURN 42360 IF DT.INT%>LAST.DAT% THEN ERROR 113 42362 IF DT.INT%<START.DAT% THEN ERROR 114 42364 CUR.PRN$=DAT$:CUR.DAT%=DT.INT% 42368 RETURN 42369 ' 42375 GOSUB 40200:GRAF.FLAG%=-1:GOSUB 50950 42377 IF DT.INT%>LAST.DAT% THEN ERROR 123 42379 IF DT.INT%<START.DAT% THEN ERROR 124 42381 GRAF.FLAG%=0:RETURN 42399 ' 42400 ' 42405 MATCH.FLAG%=0:REC.NUM%=1 42410 WHILE NOT MATCH.FLAG% 42415 REC.NUM%=REC.NUM%+1:GET #1,REC.NUM% 42420 DT.TMP%=CVS(DAT.REC$):IF DT.TMP%>=CUR.DAT% THEN MATCH.FLAG%=-1 42430 WEND 42435 DT=DT.TMP%:GOSUB 51490:CUR.PRN$=DT.PRN$:CUR.DAT%=DT 42440 RETURN 42449 ' 42450 STK.MAX%=0 42460 FOR REC.NUM%=2 TO 21 42462 GET #1,REC.NUM%:TR.SP$=SYMBOL$:GOSUB 42050:STK.INX$(REC.NUM%-1)=TR.SP$ 42468 IF STK.INX$(REC.NUM%-1)<>STRING$(8,0) THEN STK.MAX%=REC.NUM%-1 42469 NEXT 42470 SCRATCH!=FRE(""):RETURN 42474 ' 42475 ' 42477 X%=PROG.SCR%+1:GOSUB 40175 42478 FOR N%=1 TO STK.MAX% 42479 X%=(N%+(N%>10)*10)+5:Y%=20-((N%>10)*30) 42481 IF STK.INX$(N%)<>STRING$(8,0) THEN LOCATE X%,Y%:COLOR 15,0:PRINT N%;:COLOR 7,0:PRINT STK.INX$(N%) 42482 NEXT 42483 RETURN 42484 ' 42485 ' 42486 LOCATE 23,1:PRINT CEL$;:LOCATE 23,1:PRINT "Which stock? "; 42487 X%=23:Y%=14:TEST.TYP%=1:MAX.LN%=2:GOSUB 44000 42488 IF VAL(INP.TMP$)>STK.MAX% THEN ERROR 107 42489 STK.NUM%=VAL(INP.TMP$):RETURN 42499 ' 42500 ' 42505 X%=PROG.SCR%+1:GOSUB 40175 42506 FOR N%=1 TO PRN.MAX% 42510 X%=FNROW%(IO.BUF$(N%,4)):Y%=FNCOL%(IO.BUF$(N%,4)) ' 42515 LOCATE X%,Y%:PRINT IO.BUF$(N%,3) 42520 IF REPORT.DO% THEN LOCATE X%,Y%+18:PRINT IO.BUF$(N%,1) 42525 NEXT 42530 SCRATCH!=FRE(""):RETURN 42539 ' 42550 ' 42557 X%=PROG.SCR%+1:GOSUB 40175 42558 FOR N%=1 TO ABS(STK.MAX%>10)+1 42559 Y%=((N%-1)*40)+10 42560 LOCATE 6,Y%:COLOR 15,0:PRINT "Price"+SPACE$(10)+"Volume";:COLOR 7,0 42561 NEXT 42562 FOR N%=1 TO STK.MAX% 42563 IF STK.INX$(N%)=STRING$(8,0) THEN 42570 42564 X%=(N%+(N%>10)*10)+7:Y%=((N%>10)*-40)+1 42566 LOCATE X%,Y%:PRINT STK.INX$(N%) 42568 IF REPORT.DO% THEN LOCATE X%,Y%+9:PRINT IO.BUF$(N%,1);:LOCATE X%,Y%+24:PRINT IO.BUF$(N%,2) 42570 NEXT 42575 SCRATCH!=FRE(""):RETURN 42579 ' 42600 ' 42604 ' 42605 FOR N%=1 TO PRN.MAX% 42610 X%=FNROW%(IO.BUF$(N%,4)):Y%=FNCOL%(IO.BUF$(N%,4))+18 42615 GOSUB 44000 42617 IF T.BILL.FLAG% THEN IF N%<3 THEN 42625 42618 IF BOND.FLAG% THEN IF N%<3 OR N%=6 THEN 42625 42620 IF TEST.TYP%=2 THEN GOSUB 44750 42625 IO.BUF$(N%,1)=INP.TMP$ 42630 NEXT 42635 SCRATCH!=FRE(""):RETURN 42699 ' 42700 F1.MSG$="Edit":F2.MSG$="Write to disk":ESC.MSG$="Return to previous menu" 42704 GOSUB 42750 42706 RETURN 42709 ' 42710 F1.MSG$="Write to disk":F2.MSG$="":ESC.MSG$="Return to menu" 42714 GOSUB 42750 42716 RETURN 42719 ' 42720 F1.MSG$="Do another analysis":F2.MSG$="":ESC.MSG$="Return to menu" 42724 GOSUB 42750 42726 RETURN 42729 ' 42730 F1.MSG$="Write data to file":ESC.MSG$="Return to menu" 42732 GOSUB 42750 42733 RETURN 42734 ' 42740 F1.MSG$="Enter another date":ESC.MSG$="Return to previous menu" 42741 ' 42742 GOSUB 42750 42743 RETURN 42745 F1.MSG$="Write data to file":ESC.MSG$="Return to main menu" 42747 GOSUB 42750 42748 RETURN 42750 ' 42755 FUNC.FLAG%=0:DONE.FLAG%=0:EDIT.BRANCH%=0 42760 LOCATE 24,1:PRINT SPACE$(60);:LOCATE 24,1 42765 COLOR 0,7:PRINT "F1";:COLOR 7,0:PRINT " "+F1.MSG$+" "; 42770 IF F2.MSG$<>"" THEN COLOR 0,7:PRINT "F2";:COLOR 7,0:PRINT " "+F2.MSG$+" "; 42772 COLOR 0,7:PRINT "ESC";:COLOR 7,0:PRINT " "+ESC.MSG$+" "; 42773 RETURN 42774 ' 42775 ' 42776 GOSUB 44200 42777 IF ASC.RESP%=27 THEN EDIT.BRANCH%=3:RETURN 42778 IF NOT FUNC.FLAG% THEN PRINT CHR$(7);:GOTO 42776 42779 IF ASC.RESP%=F1% THEN EDIT.BRANCH%=1 42780 IF ASC.RESP%=F2% AND F2.MSG$<>"" THEN EDIT.BRANCH%=2 42781 IF EDIT.BRANCH%=0 THEN PRINT CHR$(7);:GOTO 42776 42782 LOCATE 24,1:PRINT SPACE$(79);:RETURN 42784 ' 42785 LOCATE 23,60:COLOR 0,7:PRINT "Please wait";:COLOR 7,0:RETURN 42786 ' 42792 LOCATE 23,60:PRINT SPACE$(19);:RETURN 42793 ' 42795 GOSUB 42792:LOCATE 23,1:PRINT SPACE$(50):LOCATE 23,1:PRINT "Are you sure (y/n)?" 42796 TEST.TYP%=3:MAX.LN%=1:X%=23:Y%=22:GOSUB 44000 42797 IF INP.TMP$="Y" OR INP.TMP$="y" THEN CONFIRM.FLAG%=-1 ELSE CONFIRM.FLAG%=0 42798 RETURN 42799 ' 42800 ' 42805 FOR REC%=1 TO PRN.MAX% 42810 TST.TMP$=FNUS$(FNEXTRACT$(REC.BUF$,REC%)) 42811 IF STK.MOD% THEN IF REC%<8 THEN INT.FLAG%=0 ELSE INT.FLAG%=-1 42812 IF BOND.MOD% THEN IF REC%<15 THEN INT.FLAG%=0 ELSE INT.FLAG%=-1 42813 GOSUB 42990:IO.BUF$(REC%,1)=TST.TMP$ 42815 NEXT 42817 SCRATCH!=FRE(""):RETURN 42849 ' 42850 ' 42855 GOSUB 42785:RECORD.TMP$="" 42860 FOR N%=1 TO PRN.MAX% 42865 RECORD.TMP$=RECORD.TMP$+FNPS$(IO.BUF$(N%,1)) 42870 NEXT 42871 LSET RECORD$=RECORD.TMP$ 42872 IF BOND.MOD% THEN LSET DAT.REC$=MKS$(CUR.DAT%) 42873 PUT#1,REC.NUM% 42875 SCRATCH!=FRE(""):GOSUB 42792:RETURN 42879 ' 42880 ' 42881 REC.NUM%=REC.NUM.START% 42882 WHILE FILL.COUNT%>0 42883 GET #1,REC.NUM%:REC.BUF$=RECORD$ 42884 IF LEFT$(REC.BUF$,4)<>STRING$(4,0) THEN WHOLE.REC.BUF$(FILL.COUNT%)=REC.BUF$:FILL.COUNT%=FILL.COUNT%-1 42886 REC.NUM%=REC.NUM%-1 42887 WEND 42888 FILL.COUNT%=10:RETURN 42889 ' 42899 ' 42900 ' 42905 FOR REC%=LAST.REC%+1 TO REC.NUM% 42910 LSET RECORD$=STRING$(REC.LEN%,0) 42915 PUT#1,REC% 42920 NEXT 42925 RETURN 42949 ' 42950 ' 42952 FOR REC%=1 TO STK.MAX% 42954 REC.TMP$=FNSTK.EXTRACT$(REC.BUF$,REC%) 42956 TST.TMP$=FNUS$(LEFT$(REC.TMP$,4)):INT.FLAG%=0:GOSUB 42990:IO.BUF$(REC%,1)=TST.TMP$ 42957 TST.TMP$=FNUS$(RIGHT$(REC.TMP$,4)):INT.FLAG%=-1:GOSUB 42990:IO.BUF$(REC%,2)=TST.TMP$ 42960 NEXT 42968 RETURN 42969 ' 42975 ' 42976 GOSUB 42785:RECORD.TMP$="" 42977 FOR REC%=1 TO STK.MAX% 42978 RECORD.TMP$=RECORD.TMP$+FNPS$(IO.BUF$(REC%,1))+FNPS$(IO.BUF$(REC%,2)) 42979 NEXT 42980 RECORD.TMP$=RECORD.TMP$+STRING$((20-STK.MAX%)*8,0) 42981 LSET RECORD$=RECORD.TMP$:PUT #1,REC.NUM% 42982 SCRATCH!=FRE(""):GOSUB 42792:RETURN 42989 ' 42990 TST.TMP#=VAL(TST.TMP$) 42991 IF TST.TMP#>3750 OR INT.FLAG% THEN 42996 42992 TST.TMP#=INT((TST.TMP#*100)+0.56)/100 42993 TST.TMP$=STR$(TST.TMP#) 42994 BRK.POS%=INSTR(TST.TMP$,".") 42995 IF BRK.POS% THEN GOSUB 42998 ELSE TST.TMP$=TST.TMP$+".00" 42996 IF LEN(TST.TMP$)>8 THEN TST.TMP$=LEFT$(TST.TMP$,8) ELSE TST.TMP$=SPACE$(8-LEN(TST.TMP$))+TST.TMP$:RETURN 42997 ' 42998 IF LEN(TST.TMP$)-BRK.POS%=1 THEN TST.TMP$=TST.TMP$+"0" 42999 RETURN 43000 ' 43001 ' 43002 ' 43020 ' 43030 ' 43035 ER.N%=101:GOSUB 42710 43040 ROW%=1:COL%=1:GOSUB 43260 43050 GOSUB 44200 43070 IF FUNC.FLAG% THEN IF FNARROW%(ASC.RESP%) THEN GOSUB 43130:GOSUB 43260:GOTO 43050 43072 IF FUNC.FLAG% THEN IF ASC.RESP%=F1% THEN GOSUB 42850:RETURN 43075 IF ASC.RESP%=27 THEN RETURN 43080 IF FUNC.FLAG% OR ASC.RESP%<45 OR ASC.RESP%>122 THEN ERROR 101 43085 LEAD.IN$=RESP$:GOSUB 44000 43090 LOCATE X%,Y% 43095 IF SWAP.FLAG% THEN GOSUB 44750:IO.BUF$(FLD.NUM%,1)=INP.TMP$ 43100 GOTO 43050 43120 ' 43130 ' 43160 IF ASC.RESP%=UP.ARROW% THEN ROW%=ROW%-1 43170 IF ASC.RESP%=DOWN.ARROW% THEN ROW%=ROW%+1 43180 IF ASC.RESP%=LFT.ARROW% THEN COL%=COL%-1 43190 IF ASC.RESP%=RT.ARROW% THEN COL%=COL%+1 43195 GOSUB 43250:GOSUB 43260 43240 IF BLANK.FLAG% THEN COL%=COL%+1:GOSUB 43250:GOSUB 43260 43245 RETURN 43249 ' 43250 ' 43251 IF COL%>MAX.COL% THEN ROW%=ROW%+1:COL%=1 43253 IF COL%=0 THEN ROW%=ROW%-1:COL%=MAX.COL% 43255 IF ROW%>MAX.ROW% THEN ROW%=1 43257 IF ROW%=0 THEN ROW%=MAX.ROW% 43258 RETURN 43259 ' 43260 ' 43275 BLANK.FLAG%=0:FLD.NUM%=VAL(FLD.PTR$(ROW%,COL%,MOD.TYP%)) 43285 IF FLD.NUM%=0 THEN BLANK.FLAG%=-1:RETURN 43290 X%=VAL(LEFT$(IO.BUF$(FLD.NUM%,4),2))+PROG.SCR%:Y%=VAL(RIGHT$(IO.BUF$(FLD.NUM%,4),2))+18 43310 LOCATE X%,Y% 43320 RETURN 43330 ' 43500 ' 43510 ER.N%=102:GOSUB 42710 43540 FLD.NUM%=1:GOSUB 43675 43550 GOSUB 44200 43560 IF ASC.RESP%=27 THEN RETURN 43570 IF FUNC.FLAG% THEN IF FNARROW%(ASC.RESP%) THEN GOSUB 43630:GOSUB 43675:GOTO 43550 43572 IF FUNC.FLAG% THEN IF ASC.RESP%=F1% THEN WRITE.FLAG%=-1:RETURN 43580 IF FUNC.FLAG% OR ASC.RESP%<45 OR ASC.RESP%>122 THEN ERROR 102 43585 LEAD.IN$=RESP$:GOSUB 44000 43590 LOCATE X%,Y% 43595 IF SWAP.FLAG% THEN GOSUB 44750:IO.BUF$(FLD.NUM%,1)=INP.TMP$:GOSUB 43630:GOSUB 43675 43600 GOTO 43550 43620 ' 43630 ' 43660 IF ASC.RESP%=DOWN.ARROW% OR ASC.RESP%=RT.ARROW% THEN FLD.NUM%=FLD.NUM%+1 43662 IF ASC.RESP%=UP.ARROW% OR ASC.RESP%=LFT.ARROW% THEN FLD.NUM%=FLD.NUM%-1 43664 IF FLD.NUM%>BUF.MAX% THEN FLD.NUM%=1 43665 IF FLD.NUM%=0 THEN FLD.NUM%=BUF.MAX% 43666 FUNC.FLAG%=0:RETURN 43669 ' 43675 ' 43680 X%=VAL(LEFT$(IO.BUF$(FLD.NUM%,4),2))+PROG.SCR% 43682 Y%=VAL(RIGHT$(IO.BUF$(FLD.NUM%,4),2))+18 43683 LOCATE X%,Y% 43684 RETURN 43689 ' 43750 ' 43752 ER.N%=103:GOSUB 42710 43755 FLD.NUM%=1:COL%=1:GOSUB 43875 43760 ERR.FLAG%=0:GOSUB 44200 43761 IF ASC.RESP%=27 THEN RETURN 43765 IF FUNC.FLAG% THEN IF FNARROW%(ASC.RESP%) THEN GOSUB 43830:GOSUB 43875:GOTO 43760 43770 IF FUNC.FLAG% THEN IF ASC.RESP%=F1% THEN GOSUB 42975::RETURN 43775 IF ASC.RESP%=27 THEN RETURN 43780 IF FUNC.FLAG% OR ASC.RESP%<45 OR ASC.RESP%>122 THEN ERROR 103 43785 LEAD.IN$=RESP$:GOSUB 44000 43790 LOCATE X%,Y% 43795 IF SWAP.FLAG% THEN GOSUB 44750:IO.BUF$(FLD.NUM%,COL%)=INP.TMP$ 43800 GOTO 43760 43810 ' 43830 ' 43860 IF ASC.RESP%=DOWN.ARROW% THEN FLD.NUM%=FLD.NUM%+1 43861 IF ASC.RESP%=UP.ARROW% THEN FLD.NUM%=FLD.NUM%-1 43862 IF ASC.RESP%=LFT.ARROW% THEN COL%=COL%-1 43863 IF ASC.RESP%=RT.ARROW% THEN COL%=COL%+1 43864 IF COL%>2 THEN FLD.NUM%=FLD.NUM%+1:COL%=1 43865 IF COL%<1 THEN FLD.NUM%=FLD.NUM%-1:COL%=2 43866 IF FLD.NUM%=0 THEN FLD.NUM%=STK.MAX% 43867 IF FLD.NUM%>STK.MAX% THEN FLD.NUM%=1 43868 RETURN 43869 ' 43875 ' 43876 IF STK.INX$(FLD.NUM%)=STRING$(8,0) THEN GOSUB 43890:GOTO 43876 43880 IF FLD.NUM%<11 THEN X%=FLD.NUM% ELSE X%=FLD.NUM%-10 43881 X%=X%+PROG.SCR%+2:Y%=((FLD.NUM%>10)*-40)+((COL%-1)*15)+10 43883 LOCATE X%,Y% 43884 RETURN 43885 ' 43890 IF ASC.RESP%=RT.ARROW% OR ASC.RESP%=DOWN.ARROW% THEN ASC.RESP%=DOWN.ARROW%:GOSUB 43830:RETURN 43891 IF ASC.RESP%=UP.ARROW% OR ASC.RESP%=LFT.ARROW% THEN ASC.RESP%=UP.ARROW%:GOSUB 43830:RETURN 43892 ' 44000 ' 44060 GOSUB 40190:FUNC.FLAG%=0:SWAP.FLAG%=0:INP.TMP$="":RESP.CUM$="":X.PRN%=X%:Y.PRN%=Y% 44080 LOCATE X.PRN%,Y.PRN% 44090 IF LEAD.IN$<>"" THEN GOSUB 44190:IF ERR.FLAG% THEN ERROR ER.N% ELSE 44120 44100 GOSUB 44200 44102 IF ASC.RESP%=27 THEN GOSUB 44470:RETURN 44104 IF ASC.RESP%=13 THEN GOSUB 44510:RETURN 44106 IF ASC.RESP%=8 OR ASC.RESP%=127 THEN GOSUB 44400:GOTO 44100 44108 IF LEN(RESP.CUM$)=MAX.LN% THEN ERROR 105 44110 ERR.FLAG%=0:ON TEST.TYP% GOSUB 44220,44230,44240 44115 IF ERR.FLAG% THEN ERROR 105 44120 GOSUB 44320:GOTO 44100 44150 ' 44190 ' 44191 ' 44192 RESP$=LEAD.IN$:LEAD.IN$="" 44194 ON TEST.TYP% GOSUB 44220,44230,44240 44195 IF NOT ERR.FLAG% THEN PRINT SPACE$(MAX.LN%):LOCATE X%,Y% 44196 RETURN 44199 ' 44200 ' 44201 RESP$=INKEY$:IF RESP$="" THEN 44201 44202 IF LEN(RESP$)>1 THEN FUNC.FLAG%=-1:RESP$=RIGHT$(RESP$,1):GOTO 44204 44203 IF LEN(RESP$)=1 THEN FUNC.FLAG%=0 44204 ASC.RESP%=ASC(RESP$) 44205 ERR.FLAG%=0:RETURN 44219 ' 44220 IF FUNC.FLAG% THEN ERR.FLAG%=-1:RETURN 44223 IF NOT FNNUMBER%(RESP$) THEN ERR.FLAG%=-1 44224 RETURN 44229 ' 44230 IF FUNC.FLAG% THEN ERR.FLAG%=-1:RETURN 44233 IF NOT FNNUMOP%(RESP$) THEN ERR.FLAG%=-1: 44234 RETURN 44239 ' 44240 IF FUNC.FLAG% THEN ERR.FLAG%=-1:RETURN 44243 IF ASC.RESP%<31 OR ASC.RESP%>126 THEN ERR.FLAG%=-1:RETURN 44244 IF CAP.FLAG% AND FNLETTER%(RESP$) THEN RESP$=FNFOLD$(RESP$) 44246 RETURN 44249 ' 44320 RESP.CUM$=RESP.CUM$+RESP$:LOCATE X.PRN%,Y.PRN%:PRINT RESP$;:Y.PRN%=Y.PRN%+1:RETURN 44399 ' 44400 IF Y.PRN%=Y% THEN ERROR 105 44410 RESP.CUM$=LEFT$(RESP.CUM$,LEN(RESP.CUM$)-1):LOCATE X.PRN%,Y.PRN%:PRINT BS$;:Y.PRN%=Y.PRN%-1 44460 RETURN 44470 ' 44480 LOCATE X%,Y%:PRINT SPACE$(LEN(RESP.CUM$)):LOCATE X%,Y% 44490 RESP.CUM$="":LEAD.IN$="":SWAP.FLAG%=0:Y.PRN%=Y% 44500 RETURN 44510 ' 44520 INP.TMP$=RESP.CUM$:SWAP.FLAG%=-1:RESP$="":RETURN 44750 ' 44752 BRK.1%=0:BRK.2%=0:ERR.FLAG%=0 44756 IF INSTR(INP.TMP$,"/") THEN GOSUB 44762 ELSE IF INSTR(INP.TMP$,"'") THEN GOSUB 44782 ELSE GOSUB 44802 44757 INP.TMP$=STR$(P!) 44758 RETURN 44760 ' 44762 BRK.1%=INSTR(INP.TMP$," ") 44766 IF BRK.1%=0 THEN PR.1$="0":PR.2$=INP.TMP$:GOTO 44770 44768 GOSUB 44794 44770 BRK.2%=INSTR(PR.2$,"/") 44772 NUMER$=LEFT$(PR.2$,BRK.2%-1):DENOM$=RIGHT$(PR.2$,LEN(PR.2$)-BRK.2%) 44774 IF VAL(DENOM$)=0 THEN ERROR 116 44776 PR.2!=VAL(NUMER$)/VAL(DENOM$):PR.1!=VAL(PR.1$):P!=PR.1!+PR.2! 44778 RETURN 44780 ' 44782 BRK.1%=INSTR(INP.TMP$,"'"):PR.1!=VAL(PR.1$):PR.2!=VAL(PR.2$)/32:P!=PR.1!+PR.2!:RETURN 44792 ' 44794 PR.1$=LEFT$(INP.TMP$,BRK.1%-1):PR.2$=RIGHT$(INP.TMP$,LEN(INP.TMP$)-BRK.1%) 44800 RETURN 44802 ' 44804 P!=VAL(INP.TMP$):RETURN 44999 ' 45000 ' 45012 X%=PROG.SCR%+1:GOSUB 40175 45020 FOR N%=1 TO BUF.MAX% 45024 BUF.MAX.SPLIT%=INT((BUF.MAX%+1)/2) 45028 X%=(N%+(N%>BUF.MAX.SPLIT%)*BUF.MAX.SPLIT%)+5:Y%=20-((N%>BUF.MAX.SPLIT%)*25) ' 45032 LOCATE X%,Y%:COLOR 15,0:PRINT N%;:COLOR 7,0:PRINT IO.BUF$(N%,3) 45036 NEXT 45040 RETURN 45041 ' 45044 ' 45048 ' 45052 LOCATE 23,1:PRINT SPACE$(79) 45056 LOCATE 23,1:PRINT "Which value "+PROMPT.TAG$; 45060 X%=23:Y%=13+LEN(PROMPT.TAG$):MAX.LN%=2:TEST.TYP%=1:GOSUB 44000 45064 VAL.PTR%=VAL(INP.TMP$) 45068 RETURN 45072 ' 45076 ' 45080 LOCATE 23,1:PRINT SPACE$(40) 45082 IF BOND.MOD% THEN MA.UNIT$="weeks" ELSE MA.UNIT$="days" 45084 LOCATE 23,1:PRINT "Enter term ("+MA.UNIT$+")"; 45088 X%=23:Y%=20:TEST.TYP%=1:MAX.LN%=3:GOSUB 44000 45092 TERM!=VAL(INP.TMP$) 45096 RETURN 45100 ' 45101 ' 45104 ' 45106 FILL.COUNT%=1:REC.NUM%=START.REC%:OUT.OF.DTA%=0:MAX.POINTS%=75 45108 WHILE FILL.COUNT%<=MAX.POINTS% AND NOT OUT.OF.DTA% 45110 IF REC.NUM%=LAST.REC% THEN OUT.OF.DTA%=-1 45112 GET #1,REC.NUM%:REC.TMP$=RECORD$ 45114 IF LEFT$(REC.TMP$,4)=STRING$(4,0) OR LEFT$(REC.TMP$,4)=MKS$(32767) THEN 45121 45116 IF STK.HIS% THEN GOSUB 45136 ELSE GOSUB 45128 45120 FILL.COUNT%=FILL.COUNT%+1 45121 REC.NUM%=REC.NUM%+1 45122 WEND 45125 MAX.POINTS%=FILL.COUNT%-1 45126 RETURN 45127 ' 45128 IF STK.MOD% THEN IF VAL.PTR%=16 THEN VAL.BUF!(FILL.COUNT%+TERM!-1,BUF.LOC%)=FNTRIN!(REC.TMP$):GOTO 45132 45129 IF STK.MOD% THEN IF VAL.PTR%=17 THEN VAL.BUF!(FILL.COUNT%+TERM!-1,BUF.LOC%)=FNAD!(REC.TMP$):GOTO 45132 45130 VAL.BUF!(FILL.COUNT%+TERM!-1,BUF.LOC%)=CVS(FNEXTRACT$(REC.TMP$,VAL.PTR%)) 45132 IF STK.MOD% THEN VAL.BUF!(FILL.COUNT%+TERM!-1,4)=(REC.NUM%+START.DAT%-2) 45133 IF BOND.MOD% THEN VAL.BUF!(FILL.COUNT%+TERM!-1,4)=CVS(DAT.REC$) 45134 RETURN 45135 ' 45136 REC.TMP$=FNSTK.EXTRACT$(REC.TMP$,STK.NUM%) 45137 VAL.BUF!(FILL.COUNT%+TERM!-1,1)=CVS(LEFT$(REC.TMP$,4)) 45138 VAL.BUF!(FILL.COUNT%+TERM!-1,3)=CVS(RIGHT$(REC.TMP$,4)) 45139 VAL.BUF!(FILL.COUNT%+TERM!-1,4)=(REC.NUM%+START.DAT%-22) 45140 RETURN 45141 ' 45144 ' 45146 FILL.COUNT%=1:REC.NUM%=START.REC%-1:OUT.OF.DTA%=0 45147 WHILE FILL.COUNT%<=TERM!-1 AND NOT OUT.OF.DTA% 45148 IF REC.NUM%=2 THEN OUT.OF.DTA%=-1 45149 GET #1,REC.NUM%:REC.TMP$=RECORD$ 45150 IF LEFT$(REC.TMP$,4)=STRING$(4,0) OR LEFT$(REC.TMP$,4)=MKS$(32767) THEN 45153 45151 IF STK.HIS% THEN GOSUB 45170 ELSE GOSUB 45160 45152 FILL.COUNT%=FILL.COUNT%+1 45153 REC.NUM%=REC.NUM%-1 45155 WEND 45156 IF OUT.OF.DTA% AND FILL.COUNT%<TERM!-1 THEN ERROR 125 45157 RETURN 45159 ' 45160 IF VAL.PTR%=16 THEN VAL.BUF!(TERM!-FILL.COUNT%,BUF.LOC%)=FNTRIN!(REC.TMP$):RETURN 45163 IF VAL.PTR%=17 THEN VAL.BUF!(TERM!-FILL.COUNT%,BUF.LOC%)=FNAD!(REC.TMP$):RETURN 45166 VAL.BUF!(TERM!-FILL.COUNT%,BUF.LOC%)=CVS(FNEXTRACT$(REC.TMP$,VAL.PTR%)) 45167 RETURN 45169 ' 45170 REC.TMP$=FNSTK.EXTRACT$(REC.TMP$,STK.NUM%) 45171 VAL.BUF!(TERM!-FILL.COUNT%,1)=CVS(LEFT$(REC.TMP$,4)) 45172 PRINT VAL.BUF!(TERM!-FILL.COUNT%,1) 45174 RETURN 45179 ' 45184 SUM!=0 45192 FOR REC.NUM%=1 TO TERM! 45196 SUM!=SUM!+VAL.BUF!(REC.NUM%,BUF.LOC%) 45200 NEXT 45204 VAL.BUF!(TERM!,2)=(SUM!/TERM!) 45208 FOR REC.NUM%=TERM!+1 TO MAX.POINTS%+TERM! 45212 DROP.OFF!=VAL.BUF!(REC.NUM%-TERM!,BUF.LOC%):SUM!=SUM!-DROP.OFF! 45216 SUM!=SUM!+(VAL.BUF!(REC.NUM%-1,BUF.LOC%)):VAL.BUF!(REC.NUM%,2)=(SUM!/TERM!) 45220 NEXT 45224 RETURN 45228 ' 45232 ' 45236 FOR REC.NUM%=MAX.POINTS%+TERM! TO TERM! STEP -1 45240 CURR!=VAL.BUF!(REC.NUM%,BUF.LOC%):PREV!=VAL.BUF!(REC.NUM%-TERM!+1,BUF.LOC%) 45244 VAL.BUF!(REC.NUM%,BUF.LOC%)=(FNPC!(PREV!,CURR!)) 45248 NEXT 45252 RETURN 45256 ' 45999 ' 46000 IF STK.HIS% THEN GOSUB 46003 ELSE GOSUB 46010 46001 GOSUB 42730:GOSUB 42775:IF EDIT.BRANCH%=1 THEN GOSUB 49500 46002 RETURN 46003 GOSUB 41180:GOSUB 42475:GOSUB 42485:LABEL.1$=STK.INX$(STK.NUM%):BUF.LOC%=1 46005 PRINT SPACE$(79);:GOSUB 45076:GOSUB 42785:GOSUB 45104:GOSUB 45144:GOSUB 45184 46006 GOSUB 46048 46008 RETURN 46009 ' 46010 GOSUB 45012:PROMPT.TAG$="":BUF.LOC%=1:GOSUB 45044:LABEL.1$=IO.BUF$(VAL.PTR%,3) 46011 GOSUB 45076:GOSUB 42785:GOSUB 45104:GOSUB 45144:GOSUB 45184 46012 IF STK.MOD% THEN VAL.PTR%=11:BUF.LOC%=3:GOSUB 45104 46013 GOSUB 46048:RETURN 46014 ' 46016 ' 46018 GOSUB 45012 46019 IF NOT STK.HIS% THEN LOCATE 17,30:COLOR 15,0:PRINT "20";:COLOR 7,0:PRINT " Define your own indicator" 46020 PROMPT.TAG$="":BUF.LOC%=1:GOSUB 45044 46021 IF VAL.PTR%=20 THEN GOSUB 47036 ELSE IF VAL.PTR%>BUF.MAX% OR VAL.PTR%=0 THEN 46018 46022 LABEL.1$=IO.BUF$(VAL.PTR%,3) 46023 GOSUB 45076:GOSUB 42785:GOSUB 45104:GOSUB 45144:GOSUB 45184 46024 GOSUB 46104 46025 GOSUB 42730:GOSUB 42775:IF EDIT.BRANCH%=1 THEN GOSUB 49500 46026 RETURN 46028 ' 46030 ' 46032 TERM!=1:GOSUB 45012 46034 PROMPT.TAG$="for 1st indicator ":GOSUB 45044 46036 GOSUB 42785:BUF.LOC%=1:GOSUB 45104:LABEL.1$=IO.BUF$(VAL.PTR%,3) 46038 GOSUB 42792:PROMPT.TAG$="for 2nd indicator ":GOSUB 45044 46040 GOSUB 42785:BUF.LOC%=3:GOSUB 45104:LABEL.2$=IO.BUF$(VAL.PTR%,3) 46042 GOSUB 46136 46043 GOSUB 42730:GOSUB 42775:IF EDIT.BRANCH%=1 THEN GOSUB 49500 46044 RETURN 46046 ' 46048 ' 46050 ' 46052 MIN!=VAL.BUF!(TERM!,1):MAX!=VAL.BUF!(TERM!,1) 46054 TEST.FEELD%=1:GOSUB 46500 46056 TEST.FEELD%=2:GOSUB 46500 46057 MIN.1!=MIN!:MAX.1!=MAX! 46058 V.POINTS!=15:X.OFF!=5:HIST.FLAG%=0:Y.PT%=6 46060 CLS:LOCATE ,,0 46062 GOSUB 46500 46064 FOR N%=TERM! TO MAX.POINTS%+TERM!-1 46066 VAL.IND!=VAL.BUF!(N%,1):PLOT.CHAR%=43 46068 GOSUB 46518:GOSUB 46532 46070 VAL.IND!=VAL.BUF!(N%,2):PLOT.CHAR%=45 46072 GOSUB 46518:GOSUB 46532 46074 Y.PT%=Y.PT%+1 46076 NEXT 46078 ' 46080 ' 46082 BUF.LOC%=3:TEST.FEELD%=BUF.LOC% 46084 MIN!=VAL.BUF!(TERM!,3):MAX!=VAL.BUF!(TERM!,3) 46086 V.POINTS!=5:X.OFF!=0:HIST.FLAG%=-1:Y.PT%=6 46088 GOSUB 46500 46090 FOR N%=TERM! TO MAX.POINTS%+TERM!-1 46092 VAL.IND!=VAL.BUF!(N%,BUF.LOC%):PLOT.CHAR%=124 46094 GOSUB 46518:GOSUB 46532 46096 Y.PT%=Y.PT%+1 46098 NEXT 46100 GOSUB 46201:RETURN 46102 ' 46104 ' 46106 MIN!=VAL.BUF!(TERM!,1):MAX!=VAL.BUF!(TERM!,1) 46108 TEST.FEELD%=1:GOSUB 46500:TEST.FEELD%=2:GOSUB 46500:MIN.1!=MIN!:MAX.1!=MAX! 46112 V.POINTS!=20:X.OFF!=0:HIST.FLAG%=0:Y.PT%=6:CLS:LOCATE ,,0 46116 GOSUB 46500 46118 FOR N%=TERM! TO MAX.POINTS%+TERM!-1 46120 VAL.IND!=VAL.BUF!(N%,1):PLOT.CHAR%=43:GOSUB 46518:GOSUB 46532 46124 VAL.IND!=VAL.BUF!(N%,2):PLOT.CHAR%=45:GOSUB 46518:GOSUB 46532 46128 Y.PT%=Y.PT%+1 46130 NEXT 46132 GOSUB 46300:RETURN 46135 ' 46136 ' 46138 MIN!=VAL.BUF!(TERM!,1):MAX!=VAL.BUF!(TERM!,1) 46140 TEST.FEELD%=1:GOSUB 46500:MIN.1!=MIN!:MAX.1!=MAX! 46142 V.POINTS!=9:X.OFF!=11:HIST.FLAG%=0:Y.PT%=6:CLS:LOCATE ,,0 46146 GOSUB 46500 46148 FOR N%=TERM! TO MAX.POINTS%+TERM!-1 46150 VAL.IND!=VAL.BUF!(N%,1):PLOT.CHAR%=43:GOSUB 46518:GOSUB 46532:Y.PT%=Y.PT%+1 46156 NEXT 46158 ' 46160 MIN!=VAL.BUF!(TERM!,3):MAX!=VAL.BUF!(TERM!,3):TEST.FEELD%=3:GOSUB 46500 ' 46163 MIN.2!=MIN!:MAX.2!=MAX!:V.POINTS!=9:X.OFF!=1:HIST.FLAG%=0:Y.PT%=6:GOSUB 46500 46168 FOR N%=TERM! TO MAX.POINTS%+TERM!-1 46170 VAL.IND!=VAL.BUF!(N%,3):PLOT.CHAR%=45 46172 GOSUB 46518:GOSUB 46532:Y.PT%=Y.PT%+1 46176 NEXT 46177 GOSUB 46400:RETURN 46180 ' 46200 ' 46201 AXIS%=21:GOSUB 46460:LOCATE AXIS%,5:PRINT CHR$(L.L.CORNER%); 46216 LOCATE AXIS%,6:PRINT STRING$(75,HOR.LIN%);:GOSUB 46468 46228 LAB.VAL!=MAX.1!:X%=1:GOSUB 46488:LAB.VAL!=MIN.1!:X%=15:GOSUB 46488 46236 LOCATE 23,5:PRINT LABEL.1$;:PRINT "; moving avg term" TERM! MA.UNIT$ 46240 RETURN 46244 ' 46300 AXIS%=21:GOSUB 46460:LOCATE AXIS%,5:PRINT CHR$(L.L.CORNER%); 46316 LOCATE AXIS%,6:PRINT STRING$(75,HOR.LIN%);:GOSUB 46468 46328 LAB.VAL!=MAX!:X%=1:GOSUB 46488:LAB.VAL!=MIN!:X%=AXIS%:GOSUB 46488 46336 LOCATE 23,5:PRINT LABEL.1$;:PRINT "; moving avg term" TERM! MA.UNIT$ 46340 RETURN 46344 ' 46400 AXIS%=20:GOSUB 46460:LOCATE 10,5:PRINT CHR$(JOINT%):LOCATE 10,6:PRINT STRING$(74,HOR.LIN%) 46420 LOCATE AXIS%,5:PRINT CHR$(L.L.CORNER%);:LOCATE AXIS%,6:PRINT STRING$(74,HOR.LIN%); 46432 GOSUB 46468 46436 LAB.VAL!=MAX.1!:X%=1:GOSUB 46488:LAB.VAL!=MIN.1!:X%=9:GOSUB 46488 46440 LAB.VAL!=MAX.2!:X%=11:GOSUB 46488:LAB.VAL!=MIN.2!:X%=20:GOSUB 46488 46448 LOCATE 23,5:PRINT LABEL.1$ " (top) & " LABEL.2$ " (bottom)" 46452 RETURN 46456 ' 46460 FOR N%=1 TO AXIS%:LOCATE N%,5:PRINT CHR$(VER.LIN%);:NEXT:RETURN 46464 ' 46468 FOR N%=6 TO MAX.POINTS% 46470 IF (N%-6) MOD 20 THEN 46471 ELSE GOSUB 46475 46471 NEXT 46472 IF MAX.POINTS%<70 THEN N%=MAX.POINTS%+5:GOSUB 46475:RETURN 46474 ' 46475 DT=VAL.BUF!(N%+TERM!-6,4):GOSUB 51490:PR.OFF%=INT((LEN(DT.PRN$)-1)/2) 46477 LOCATE AXIS%+1,N%-PR.OFF%:PRINT DT.PRN$:IF N%>6 THEN LOCATE AXIS%,N%:PRINT CHR$(NOTCH%); 46479 RETURN 46484 ' 46488 LOCATE X%,1:IF LAB.VAL!<-999 THEN PRINT USING "+####";LAB.VAL!;:RETURN 46489 IF LAB.VAL!<0 THEN PRINT USING "+###";LAB.VAL!:RETURN 46490 IF LAB.VAL!<99.99 THEN PRINT USING "##.#";LAB.VAL!:ELSE IF LAB.VAL!<9999.99 THEN PRINT USING "####";LAB.VAL!:ELSE PRINT LAB.VAL! 46496 RETURN 46500 ' 46502 FOR N%=TERM! TO MAX.POINTS%+TERM!-1 46504 TEST.VAL!=VAL.BUF!(N%,TEST.FEELD%) 46506 IF TEST.VAL!<MIN! THEN MIN!=TEST.VAL! 46508 IF TEST.VAL!>MAX! THEN MAX!=TEST.VAL! 46510 NEXT 46512 RANGE!=MAX!-MIN!:SCALE!=RANGE!/(V.POINTS!-1) 46514 RETURN 46516 ' 46518 X.PT%=INT((VAL.IND!-MIN!)/SCALE!+0.5):X.PT%=SCR.PTS%-X.PT% 46526 X.PT%=X.PT%-X.OFF! 46528 RETURN 46530 ' 46532 LOCATE X.PT%,Y.PT%:PRINT CHR$(PLOT.CHAR%) 46540 IF NOT HIST.FLAG% THEN 46548 46542 FOR Q%=X.PT%+1 TO SCR.PTS%:LOCATE Q%,Y.PT%:PRINT CHR$(PLOT.CHAR%):NEXT 46548 RETURN 46550 ' 46999 ' 47036 GOSUB 47200:GOSUB 45076:GOTO 48000 47050 GOSUB 45184:GOSUB 46104:GOSUB 42730:GOSUB 42775:IF EDIT.BRANCH%=1 THEN GOSUB 49500 47060 RUN 47064 ' 47200 ' 47210 LOCATE 23,1:PRINT SPACE$(70):LOCATE 23,1:PRINT "Enter formula" 47211 X%=23:Y%=15:TEST.TYP%=3:MAX.LN%=20:GOSUB 44000:EXP.ORIG$=INP.TMP$ 47212 LOCATE 23,1:PRINT SPACE$(70):LOCATE 23,1:PRINT "Enter descriptive label" 47213 Y%=25:TEST.TYP%=3:MAX.LN%=16:GOSUB 44000:LABEL.1$=INP.TMP$ 47215 RETURN 47999 ' 48000 GOSUB 42785:EXP.NEW$="":GOSUB 48040 48005 OPEN "O",2,"TEMP.$$$" 48010 PRINT #2, "49108 FILL.COUNT%=1:REC.NUM%=START.REC%:OUT.OF.DTA%=0:MAX.POINTS%=H.POINTS% 48011 PRINT #2, "49128 VAL.BUF!(TERM!+FILL.COUNT%-1,BUF.LOC%)=" EXP.NEW$ 48012 PRINT #2, "49230 VAL.BUF!(TERM!-FILL.COUNT%,BUF.LOC%)=" EXP.NEW$ 48016 CLOSE #2 48020 CHAIN MERGE "TEMP.$$$",49108,ALL 48030 ' 48040 WHILE COUNT%<LEN(EXP.ORIG$) 48056 COUNT%=COUNT%+1:TEST.1.CHAR$=MID$(EXP.ORIG$,COUNT%,1) 48064 IF TEST.1.CHAR$="V" OR TEST.1.CHAR$="v" THEN GOSUB 48084:GOTO 48076 48068 IF FNNUMBER%(TEST.1.CHAR$) THEN GOSUB 48124:GOTO 48076 48072 GOSUB 48140 48076 WEND 48080 RETURN 48084 ' 48088 TEST.2.CHAR$=MID$(EXP.ORIG$,COUNT%+1,1):IF NOT FNNUMBER%(TEST.2.CHAR$) THEN ERROR 150 48092 TEST.1.CHAR$=TEST.2.CHAR$:COUNT%=COUNT%+1 48096 EXP.TMP$="FNNUM.EXTRACT!(REC.TMP$,"+TEST.1.CHAR$ 48100 IF COUNT%=LEN(EXP.ORIG$) THEN 48112 48104 TEST.2.CHAR$=MID$(EXP.ORIG$,COUNT%+1,1) 48108 IF FNNUMBER%(TEST.2.CHAR$) THEN EXP.TMP$=EXP.TMP$+TEST.2.CHAR$:COUNT%=COUNT%+1 48112 EXP.NEW$=EXP.NEW$+EXP.TMP$+")" 48116 RETURN 48120 ' 48124 EXP.NEW$=EXP.NEW$+TEST.1.CHAR$:RETURN 48136 ' 48140 IF NOT FNOP%(TEST.1.CHAR$) THEN RETURN 48148 EXP.NEW$=EXP.NEW$+TEST.1.CHAR$ 48152 RETURN 48156 ' 49104 ' 49108 FILL.COUNT%=1:REC.NUM%=START.REC%:OUT.OF.DTA%=0:MAX.POINTS%=H.POINTS% 49110 ON ERROR GOTO 60000:KILL "TEMP.$$$" 49112 WHILE FILL.COUNT%<=H.POINTS% AND NOT OUT.OF.DTA% 49116 IF REC.NUM%=LAST.REC% THEN OUT.OF.DTA%=-1 49120 GET #1,REC.NUM%:REC.TMP$=RECORD$ 49124 IF LEFT$(REC.TMP$,4)=STRING$(4,0) OR LEFT$(REC.TMP$,4)=MKS$(32767) THEN 49136 49128 VAL.BUF!(TERM!+FILL.COUNT%-1,BUF.LOC%)=FNNUM.EXTRACT!(REC.TMP$,8)-FNNUM.EXTRACT!(REC.TMP$,9) 49129 IF STK.MOD% THEN VAL.BUF!(FILL.COUNT%+TERM!-1,4)=(REC.NUM%+START.DAT%-2) 49130 IF BOND.MOD% THEN VAL.BUF!(FILL.COUNT%+TERM!-1,4)=CVS(DAT.REC$) 49132 FILL.COUNT%=FILL.COUNT%+1 49136 REC.NUM%=REC.NUM%+1 49140 WEND 49144 MAX.POINTS%=FILL.COUNT%-1 49146 ' 49215 OUT.OF.DTA%=0:FILL.COUNT%=1:REC.NUM%=START.REC%-1 49216 WHILE FILL.COUNT%<=TERM!-1 AND NOT OUT.OF.DTA% 49220 IF REC.NUM%=2 THEN OUT.OF.DTA%=-1 49224 GET #1,REC.NUM%:REC.TMP$=RECORD$ 49228 IF LEFT$(REC.TMP$,4)=STRING$(4,0) OR LEFT$(REC.TMP$,4)=MKS$(32767) THEN 49248 49230 VAL.BUF!(TERM!-FILL.COUNT%,BUF.LOC%)=FNNUM.EXTRACT!(REC.TMP$,8)-FNNUM.EXTRACT!(REC.TMP$,9) 49244 FILL.COUNT%=FILL.COUNT%+1 49248 REC.NUM%=REC.NUM%-1 49252 WEND 49256 GOTO 47050 49260 ' 49500 LOCATE ,,1:F1.MSG$="Output to text file":F2.MSG$="Output to DIF file":ESC.MSG$="Return to menu":GOSUB 42750:GOSUB 42776 49501 IF EDIT.BRANCH%=3 THEN RETURN ELSE FIL.TYP%=EDIT.BRANCH% 49502 LOCATE 24,1:PRINT SPACE$(79);:LOCATE 24,1:PRINT "Enter a file name"; 49503 X%=24:Y%=20:TEST.TYP%=3:MAX.LN%=12:GOSUB 44000:FL.OUT$=DR$+":"+INP.TMP$ 49508 GOSUB 42785 49509 GOTO 49540 49510 LBL$(4)="NYSE Volume" 49520 LBL$(3)=STR$(TERM!)+"-Day M.A.":RETURN 49530 LBL$(3)=LABEL.2$:RETURN 49540 NV=4+(GRAF.TYP%>1):LBL$(1)="DATE":LBL$(2)=LABEL.1$:ON GRAF.TYP% GOSUB 49510, 49520, 49530 49550 OPEN FL.OUT$ FOR OUTPUT AS #3 49560 IF FIL.TYP%=2 THEN 49650 49570 DASH$=STRING$(10,45):FOR I=2 TO NV:DASH$=DASH$+STRING$(15,45):NEXT I 49580 PRINT #3, DASH$:OUTBUF$=LBL$(1)+" ":PRINT #3, OUTBUF$;:FOR I=2 TO NV-1:OUTBUF$=SPACE$(15):RSET OUTBUF$=LBL$(I):PRINT #3, OUTBUF$;:NEXT I 49590 OUTBUF$=SPACE$(15):RSET OUTBUF$=LBL$(NV):PRINT #3, OUTBUF$:PRINT #3, DASH$ 49600 FOR J=TERM! TO TERM!+MAX.POINTS%-1:DT=VAL.BUF!(J,4):GOSUB 51490:OUTBUF$=SPACE$(10):LSET OUTBUF$=DT.PRN$:PRINT #3, OUTBUF$;:PRINT #3, USING "############.##"; VAL.BUF!(J,1); VAL.BUF!(J,3+(GRAF.TYP%<>3)); 49610 IF GRAF.TYP%>1 THEN PRINT #3, "":GOTO 49630 49620 OUTBUF$=SPACE$(15):RSET OUTBUF$=STR$(VAL.BUF!(J,3)):PRINT #3, OUTBUF$ 49630 NEXT J:PRINT #3, DASH$:GOTO 49770 49650 PRINT #3, "TABLE":PRINT #3, "0,1":PRINT #3, CHR$(34);CHR$(34) 49660 PRINT #3, "VECTORS":PRINT #3, "0,";NV:PRINT #3, CHR$(34);CHR$(34) 49670 PRINT #3, "TUPLES":PRINT #3, "0,";MAX.POINTS%+1:PRINT #3, CHR$(34);CHR$(34) 49690 PRINT #3, "DATA":PRINT #3, "0,0":PRINT #3, CHR$(34);CHR$(34) 49710 PRINT #3, "-1,0":PRINT #3, "BOT" 49720 PRINT #3, "1,0":PRINT #3,CHR$(34);LBL$(1);CHR$(34):FOR J=TERM! TO TERM!+MAX.POINTS%-1:DT=VAL.BUF!(J,4):GOSUB 51490:PRINT #3, "1,0":PRINT #3, CHR$(34);DT.PRN$;CHR$(34):NEXT J 49730 FOR I=1 TO NV-1:PRINT #3, "-1,0":PRINT #3, "BOT":PRINT #3, "1,0":PRINT #3,CHR$(34);LBL$(I+1);CHR$(34) 49740 FOR J=TERM! TO TERM!+MAX.POINTS%-1:IF I=NV-1 THEN T=I+ABS(GRAF.TYP%=3) ELSE T=I 49745 PRINT #3, "0";VAL.BUF!(J,T):PRINT #3, "V":NEXT J:NEXT I 49750 PRINT #3, "-1,0":PRINT #3, "EOD" 49770 CLOSE #3 49775 SCRATCH!=FRE(0):GOSUB 42792:LOCATE 24,1:PRINT SPACE$(79);:PRINT CHR$(7);:COLOR 0,7:LOCATE 24,1:PRINT "File output complete; press any key to return to menu";:COLOR 7,0:HOOK$=INPUT$(1):GOSUB 40190:RETURN 49780 RETURN 49999 ' 50950 DT.FLAG%=0:DAT$="":LOCATE 23,1:PRINT SPACE$(79);:LOCATE 23,1 50960 IF GRAF.FLAG% THEN DT.PR$="Enter start date for graph" ELSE DT.PR$="Enter date" 50975 PRINT DT.PR$+ " (ESC to return to menu)"; 50980 TEST.TYP%=2:X%=23:Y%=36-(16*GRAF.FLAG%):MAX.LN%=10:GOSUB 44000 51010 DAT$=INP.TMP$:IF DAT$="" OR DAT$=CHR$(27) THEN RETURN 51014 GOSUB 42785:GOSUB 51050 51020 IF DT.FLAG% THEN ERROR 110 51030 CUR.DAT$=DAT$:SCRATCH!=FRE(""):GOSUB 42792:RETURN 51040 ' 51050 ' 51110 GOSUB 51180:GOSUB 51360:GOSUB 51490 51140 IF MON.ORIG%<>MON.OUT OR DAY.ORIG%<>DAY.OUT OR YR.ORIG%<>YR.OUT THEN DT.FLAG%=-1 ELSE DT.FLAG%=0 51150 DT.INT%=DT:SCRATCH!=FRE("") 51160 RETURN 51170 ' 51180 ' 51240 BRK.1%=0:BRK.2%=0 51250 FOR N%=1 TO LEN(DAT$) 51260 ELEM$=MID$(DAT$,N%,1) 51270 IF ASC(ELEM$)>=48 AND ASC(ELEM$)<=57 THEN 51290 51280 IF BRK.1%=0 THEN BRK.1%=N% ELSE BRK.2%=N% 51290 NEXT 51300 MON.ORIG%=VAL(LEFT$(DAT$,BRK.1%-1)):DAY.ORIG%=VAL(MID$(DAT$,BRK.1%+1,BRK.2%-BRK.1%-1)) 51320 YR.ORIG%=VAL(MID$(DAT$,BRK.2%+1,4)):IF YR.ORIG%>1999 THEN YR.ORIG%=YR.ORIG%-1900 51340 RETURN 51350 ' 51360 ' 51420 DAY.INP=DAY.ORIG%:MON.INP=MON.ORIG%:YR.INP=YR.ORIG%:YR.INP=YR.INP+1900 51440 IF MON.INP<3 THEN YR.INP=YR.INP-1:MON.INP=MON.INP+13:ELSE:MON.INP=MON.INP+1 51450 DT=INT(365.25*YR.INP)+INT(30.6001*MON.INP)+DAY.INP-722527 51460 YR.INP=YR.INP-1900 51470 RETURN 51480 ' 51490 ' 51550 DT1=DT+722527:YR.OUT=INT((DT1-122.1)/365.25) 51560 MON.OUT=INT((DT1-INT(365.25*YR.OUT))/30.6001) 51570 DAY.OUT=DT1-INT(365.25*YR.OUT)-INT(30.6001*MON.OUT) 51580 IF MON.OUT>13 THEN MON.OUT=MON.OUT-13 ELSE MON.OUT=MON.OUT-1 51590 YR.OUT=YR.OUT-1900:IF MON.OUT<3 THEN YR.OUT=YR.OUT+1 51600 IF YR.OUT>99 THEN YR.PRN$=FNSTRIP$(YR.OUT+1900) ELSE YR.PRN$=FNSTRIP$(YR.OUT) 51610 DT.PRN$=FNSTRIP$(MON.OUT)+"/"+FNSTRIP$(DAY.OUT)+"/"+YR.PRN$ 51620 RETURN 52000 ' 52002 DAT$=DAT1$:GOSUB 51050:DT.1%=DT.INT% 52004 IF YR.ORIG% MOD 4=0 AND MON.ORIG%<3 THEN Y.1.LEN%=366 ELSE Y.1.LEN%=365 52006 DAT$=DAT2$:GOSUB 51050:DT.2%=DT.INT% 52008 IF YR.ORIG% MOD 4=0 AND MON.ORIG%<3 THEN Y.2.LEN%=366 ELSE Y.2.LEN%=365 52010 DBD%=DT.2%-DT.1%:RETURN 52019 ' 59999 ' 60000 ' 60001 PRINT CHR$(7); 60002 IF ERR=53 AND ERL=41500 THEN ERR.MSG$="STOKBOND.OVR not found; exiting to DOS...":GOSUB 63000:CLS:SYSTEM 60003 IF ERR=53 THEN ERR.MSG$="File "+FIL$+" not found":GOSUB 63000:FLNF.FLAG%=-1:RESUME NEXT 60010 IF ERL=41150 AND ERR=5 THEN ERR.MSG$="BASIC must be called with /S:160":GOSUB 63000:RESUME 11000 60020 IF ERL=>44752 AND ERL<=44804 THEN PRINT CHR$(7):ERR.FLAG%=-1:RESUME 44758 60025 IF ERL>=51240 AND ERL<=51340 THEN ERR.MSG$="Unexpected date error":GOSUB 63000:RESUME 50950 60030 IF ERL=49550 THEN ERR.MSG$="Not a valid file name (output drive is "+DR$+")":GOSUB 63000:RESUME 49502 60101 IF ERR=101 THEN RESP$="":RESUME 43050 60102 IF ERR=102 THEN RESP$="":RESUME 43550 60103 IF ERR=103 THEN RESP$="":RESUME 43760 60105 IF ERR=105 THEN RESP$="":RESUME 44100 60107 IF ERR=107 THEN ERR.MSG$="There is no such value":GOSUB 63000:RESUME 42486 60108 IF ERR=108 THEN ERR.MSG$="You must delete a stock first":FULL.FLAG%=-1:GOSUB 63000:RESUME 22303 60109 IF ERR=109 THEN ERR.MSG$="You must initialize a stock first":GOSUB 63000:RESUME 22000 60110 IF ERR=110 THEN ERR.MSG$="There is no such date":GOSUB 63000:RESUME 50950 60112 IF ERR=112 THEN ERR.MSG$=D.T.E$:GOSUB 63000:RESUME 42305 60113 IF ERR=113 THEN ERR.MSG$=D.T.L$:GOSUB 63000:RESUME 42355 60114 IF ERR=114 THEN ERR.MSG$=D.T.E$:GOSUB 63000:RESUME 42355 60116 IF ERR=116 THEN ERR.FLAG%=-1:RESUME 44758 60118 IF ERR=118 THEN ERR.MSG$=N.E.D$:GOSUB 63000:RESUME 20000 60120 IF ERR=120 THEN ERR.MSG$=N.E.D$:GOSUB 63000:RESUME 30000 60123 IF ERR=123 THEN ERR.MSG$=D.T.L$:GOSUB 63000:RESUME 42375 60124 IF ERR=124 THEN ERR.MSG$=D.T.E$:GOSUB 63000:RESUME 42375 60125 IF ERR=125 OR (ERL>45146 AND ERL<45157) THEN ERR.MSG$=N.E.D$:GOSUB 63000:IF STK.MOD% THEN RESUME 21400 ELSE IF STK.HIS% THEN RESUME 22650 ELSE RESUME 31400 60299 ERR.MSG$="Unexpected error"+STR$(ERR)+" in"+STR$(ERL)+"; reloading":GOSUB 63000:RESUME 11000 62999 ' 63000 ' 63004 ' 63005 LOCATE 2,1:COLOR 0,7:PRINT "ERROR";:COLOR 7,0 63010 LOCATE 3,5:PRINT ERR.MSG$ " (ESC to clear)";:LOCATE 2,6 63015 RESP$=INKEY$:IF RESP$="" THEN 63015 63020 IF RESP$<>CHR$(27) THEN 63015 63025 FOR Q%=2 TO 3:LOCATE Q%,1:PRINT SPACE$(59);:NEXT 63030 RETURN